Does anyone know how I can put something on the desktop?

I already know the code to do it, I was just wondering what to put in the path.

For me it is

C:/Users/Matthew/Desktop

The problem is I don't know how to get the name of the user that is running the program. The "Matthew" folder will be different for everyone.
Assuming you are talking about Windows...

If you need to support Windows 2000 and newer

SHGetFolderPath function
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762181%28v=vs.85%29.aspx

(with CSIDL_DESKTOPDIRECTORY)

If you need to support Vista and newer

SHGetKnownFolderPath function
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762188%28v=vs.85%29.aspx

(with FOLDERID_Desktop)

Andy

PS The first of these two functions is prob a bit easier to use.
Last edited on
Thanks
Topic archived. No new replies allowed.