zhongxi
asked on
Getting Deskstop Path
I am trying to copy a file from one location to the desktop. But I am facing problem to get the path of desktop since the path of desktop is different from each other.
This Window function is used.
(CopyFile ("File.txt", "Special\\NewFile.txt", FALSE))
Can anyone help?
thanx
This Window function is used.
(CopyFile ("File.txt", "Special\\NewFile.txt", FALSE))
Can anyone help?
thanx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ryancys mentioned the same in the VB code.
Rosh :)
Rosh :)
Use this
Dim WSHShell as Object
dim DesktopPath as string
Set WSHShell = CreateObject("WScript.Shel l")
if (not WSHShell is nothing) then
DesktopPath = WSHShell.SpecialFolders("D esktop")
end if
You can retrieve other windows folders also
AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates
Dim WSHShell as Object
dim DesktopPath as string
Set WSHShell = CreateObject("WScript.Shel
if (not WSHShell is nothing) then
DesktopPath = WSHShell.SpecialFolders("D
end if
You can retrieve other windows folders also
AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates
vkaushik: can you please tell me how is your answer different from mine?
char buf[520];
SHGetSpecialFolderLocation
SHGetPathFromIDList(pidl, buf);
MultiByteToWideChar(CP_ACP
Good luck