|
-
Jun 2nd, 2001, 09:43 AM
#1
Thread Starter
Addicted Member
Desktop folder
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
-
Jun 2nd, 2001, 10:09 AM
#2
Member
Reply
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
What is Life? One big dream or one Big nightmere.
-
Jun 2nd, 2001, 10:29 AM
#3
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.
-
Jun 2nd, 2001, 01:33 PM
#4
If it gets blanked out, then just change the name to something else.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|