Results 1 to 4 of 4

Thread: Desktop folder

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2001
    Location
    Egypt
    Posts
    179

    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

  2. #2
    Member
    Join Date
    Mar 2001
    Posts
    60

    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.

  3. #3
    Matthew Gates
    Guest
    Try this:

    VB Code:
    1. Private Declare Function SHGetSpecialFolderLocation _
    2. Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As _
    3. Long, pidl As ITEMIDLIST) As Long
    4.  
    5. Private Declare Function SHGetPathFromIDList Lib "shell32.dll" _
    6. Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath _
    7. As String) As Long
    8.  
    9. Private Type ****EMID
    10.     cb As Long
    11.     abID As Byte
    12. End Type
    13.  
    14. Private Type ITEMIDLIST
    15.     mkid As ****EMID
    16. End Type
    17.  
    18. Const CSIDL_DESKTOP = &H0
    19. Const MAX_PATH = 260
    20.  
    21. Private Function GetSpecialfolder(CSIDL As Long) As String
    22.     Dim r As Long
    23.     Dim IDL As ITEMIDLIST
    24.     'Get the special folder
    25.     r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
    26.     If r = NOERROR Then
    27.         'Create a buffer
    28.         Path$ = Space$(512)
    29.         'Get the path from the IDList
    30.         r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
    31.         'Remove the unnecessary chr$(0)'s
    32.         GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
    33.         Exit Function
    34.     End If
    35.     GetSpecialfolder = ""
    36. End Function
    37.  
    38. Private Sub Form_Load()
    39.     Msgbox "Desktop folder: " & GetSpecialfolder(CSIDL_DESKTOP)
    40. 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.

  4. #4
    Megatron
    Guest
    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
  •  



Click Here to Expand Forum to Full Width