我如何获得桌面的路径 [英] how can I get the path of the desktop
本文介绍了我如何获得桌面的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我必须从treeview控件中显示桌面的所有文件和文件夹,但是如何提供桌面的路径.如果我检查要搜索的桌面字符串,它将开始在项目本身中搜索,并在失败时引发异常找到它..
thnx
hi all ,
I have to show all the files and the folders of the desktop from the treeview control but how can i give the path of the desktop.if I check for Desktop string to search it starts searching in the project itself and throws the exception as it fails to locate it ..
thnx
推荐答案
看看这个.
http://stackoverflow.com/questions/802179/c-reference-to-the-desktop [ ^ ]
Have a look at this.
http://stackoverflow.com/questions/802179/c-reference-to-the-desktop[^]
VB.NET
VB.NET
My.Computer.FileSystem.SpecialDirectories.Desktop
参见 ^ ]
C#
see SpecialDirectories Class[^]
C#
Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
参见 Environment.GetFolderPath方法 [ ^ ]
string pathToTheDesktopOfTheCurrentUser
= Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
这篇关于我如何获得桌面的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文