|
-
Oct 12th, 2001, 05:59 AM
#1
Thread Starter
Addicted Member
(Resolved) Get Desktop Path help...
Hello,
Would like to retrieve the path to the desktop from my app. If anyone will help please .......
Thanxs
vbBoy.
Last edited by vbBoy; Oct 14th, 2001 at 04:10 AM.
-
Oct 12th, 2001, 09:00 AM
#2
PowerPoster
-
Oct 12th, 2001, 12:04 PM
#3
To get the desktop, use the SHGetSpecialFolderLocation API function.
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 [i]S[/i]HITEMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As [i]S[/i]HITEMID
End Type
Private Function GetSpecialFolder(CSIDL As Long) As String
Dim r As Long
Dim IDL As ITEMIDLIST
r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If r = NOERROR Then
Path$ = Space$(512)
r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function
Private Sub Command1_Click()
MsgBox GetSpecialFolder(&H0)
End Sub
-
Oct 14th, 2001, 04:12 AM
#4
Thread Starter
Addicted Member
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
|