Hi,
I am trying to get the users Desktop folder, but I am unsure what API I should be using. Should I be using SHGetDesktopFolder? Is there some example code around, because I can't seem to find it.
Kind regards.
e.g.:
include \masm32\include\masm32rt.inc
.code
main proc
LOCAL sz[MAX_PATH]:CHAR
invoke SHGetFolderPath,0,CSIDL_DESKTOP,0,0,ADDR sz
print ADDR sz,13,10
inkey
exit
main endp
end main
qWord,
Thank you for the example. I really appreciate it.
I'm obviously looking in the wrong files for explanations on the Win32 API. Win32.hlp doesn't seem to have SHGetFolderPath.
Where should I be looking?
Regards.
Here (http://msdn.microsoft.com/ru-ru/library/windows/desktop/bb762181(v=vs.85).aspx) MSDN says that SHGetFolderPath function is deprecated and encourages to use SHGetKnownFolderPath function (http://msdn.microsoft.com/en-us/library/windows/desktop/bb762188(v=vs.85).aspx) instead.
Another option is the registry:
include \masm32\MasmBasic\MasmBasic.inc
Init ; ## Find Shell folders ##
Let esi="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
GetRegArray esi, My$()
For_ ecx=0 To eax-1
Print My$(ecx) ; e.g. AppData, Cookies, Desktop, ...
PrintLine At(20, Locate(y)) GetRegVal(esi, My$(ecx))
Next
Exit
end start
Output:
AppData C:\Documents and Settings\user\Dati applicazioni
Cookies C:\Documents and Settings\user\Cookies
Desktop C:\DOCUME~1\user\Desktop
Favorites C:\DOCUME~1\user\Preferiti
NetHood C:\Documents and Settings\user\Risorse di rete
Personal C:\DOCUME~1\user\Documenti
PrintHood C:\Documents and Settings\user\Risorse di stampa
Recent C:\Documents and Settings\user\Recent
SendTo C:\Documents and Settings\user\SendTo
Start Menu C:\Documents and Settings\user\Menu Avvio
Templates C:\Documents and Settings\user\Modelli
Programs C:\Documents and Settings\user\Menu Avvio\Programmi
A bit of reading for you jj
The long and sad story of the Shell Folders key (http://blogs.msdn.com/b/oldnewthing/archive/2003/11/03/55532.aspx)
Why is there the message '!Do not use this registry key' in the registry? (http://blogs.msdn.com/b/oldnewthing/archive/2011/03/22/10144082.aspx)
Quote from: sinsi on August 15, 2014, 08:48:12 AMWhy is there the message '!Do not use this registry key' in the registry? (http://blogs.msdn.com/b/oldnewthing/archive/2011/03/22/10144082.aspx)
No such message on my Win XP SP3, sinsi 8)
Thanks for the reading anyway ;-)
Quote from: vertograd on August 15, 2014, 12:17:19 AM
Here (http://msdn.microsoft.com/ru-ru/library/windows/desktop/bb762181(v=vs.85).aspx) MSDN says that SHGetFolderPath function is deprecated and encourages to use SHGetKnownFolderPath function (http://msdn.microsoft.com/en-us/library/windows/desktop/bb762188(v=vs.85).aspx) instead.
Your software won't be compatible with Win XP any more.
Thanks guys I appreciate the help.
If I may ask, could you please show me or point me to an example of native exception handling.