Hello,
How can I get the Desktop folder for the current user, for
Win NT & Win2000.
I know The desktop folder is tha same for all users in
Win 95/98/Me which is $(WinDir)\Desktop.
Thanks,
Belal Marzouk
Printable View
Hello,
How can I get the Desktop folder for the current user, for
Win NT & Win2000.
I know The desktop folder is tha same for all users in
Win 95/98/Me which is $(WinDir)\Desktop.
Thanks,
Belal Marzouk
I think its in
winnt\profiles somewhere thats where it is on my college network any wayz hope it helps or u could create a shortcut on the desktop and use the find to get its location
Try this:
VB Code:
Private Declare Function SHGetSpecialFolderLocation _ Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As _ Long, pidl As ITEMIDLIST) As Long Private Declare Function SHGetPathFromIDList Lib "shell32.dll" _ Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath _ As String) As Long Private Type ****EMID cb As Long abID As Byte End Type Private Type ITEMIDLIST mkid As ****EMID End Type Const CSIDL_DESKTOP = &H0 Const MAX_PATH = 260 Private Function GetSpecialfolder(CSIDL As Long) As String Dim r As Long Dim IDL As ITEMIDLIST 'Get the special folder r = SHGetSpecialFolderLocation(100, CSIDL, IDL) If r = NOERROR Then 'Create a buffer Path$ = Space$(512) 'Get the path from the IDList r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$) 'Remove the unnecessary chr$(0)'s GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1) Exit Function End If GetSpecialfolder = "" End Function Private Sub Form_Load() Msgbox "Desktop folder: " & GetSpecialfolder(CSIDL_DESKTOP) End Sub
The word that has the astericks around it is a curse, but not intended to be. Here's what it says:
S H I T E M I D
^No spaces.
If it gets blanked out, then just change the name to something else.