In addition to correct solution by Vivek:
There are more to it.
1) Use
Environment.GetFolderPath
with
Environment.SpecialFolder.Desktop
to get access to a desktop directory, see
http://msdn.microsoft.com/en-us/library/14tx8hby.aspx[
^].
2) Use
System.IO.Directory.GetFiles
to get the full path names all the files you need. Be careful: there is a problem here, the resolution is explained here:
Directory.Get.Files search pattern problem[
^].
3) Populate your panel with some controls you want to devise to represent a file on a desktop; probably you need to have each control clickable to do the actions a link on the real desktop usually does.
4) To implement the previous item, you will need to get access to *.LNK files which are most typically stored in the desktop. You will need P/Invoke to do that; see the code sample here:
http://stackoverflow.com/questions/139010/how-to-resolve-a-lnk-in-c[
^].
5) Your application will need to respond to changes on the desktop as the user can add, modify or remove some files. To handle those changes, you need some events triggering in your software. This is not very trivial. For this purpose, use the class
System.IO.FileSystemWatcher
, see
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx[
^].
That's it, it looks like. Please let me know if you have any problems implementing all this. If you do, I would also like to know your ultimate goals and the purpose of this application. Why doing what the real desktop is already doing?
Good luck,
—SA