除了頭文件之類的,只有一行代碼:
QDesktopServices::openUrl(QUrl("file:///\\192.121.121.100"));
192.121.121.100 是一個電腦 ip 地址,電腦上有共享的文件夾。
QDesktopServices 用來打開本地桌面是:
QDesktopServices::openUrl(QUrl("file:///C:/Documents and Settings/All Users/Desktop"));
然後,雖然不理解 file:/// 是什麼意思,但是他後面的 c:/文件目錄輸入到資源管理器地址欄可以打開文件夾,所以就把在資源管理器中打開共享文件夾的目錄放在 file:/// 就好了。
參考資料:http://blog.csdn.net/wangjian8006/article/details/41978207