Coba gunakan code berikut ini :

Option Explicit

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 SH_ITEMID
    cb As Long
    abID As Byte
End Type

Private Type ITEMIDLIST
    mkid As SH_ITEMID
End Type

Const MAX_PATH As Integer = 260
' The Desktop - virtual folder
Const CSIDL_DESKTOP = &H0
' Program Files
Const CSIDL_PROGRAMS = 2
' Control Panel - virtual folder
Const CSIDL_CONTROLS = 3
' Printers - virtual folder
Const CSIDL_PRINTERS = 4
' My Documents
Const CSIDL_DOCUMENTS = 5
' Favorites
Const CSIDL_FAVORITES = 6
' Startup Folder
Const CSIDL_STARTUP = 7
' Recent Documents
Const CSIDL_RECENT = 8
' Send To Folder
Const CSIDL_SENDTO = 9
' Recycle Bin - virtual folder
Const CSIDL_BITBUCKET = 10
' Start Menu
Const CSIDL_STARTMENU = 11
' Desktop folder
Const CSIDL_DESKTOPFOLDER = 16
' My Computer - virtual folder
Const CSIDL_DRIVES = 17
' Network Neighbourhood - virtual folder
Const CSIDL_NETWORK = 18
' NetHood Folder
Const CSIDL_NETHOOD = 19
' Fonts folder
Const CSIDL_FONTS = 20
' ShellNew folder
Const CSIDL_SHELLNEW = 21

Public Function fGetSpecialFolder(CSIDL As Long) As String
    Dim sPath As String
    Dim IDL As ITEMIDLIST
    
    fGetSpecialFolder = ""
    If SHGetSpecialFolderLocation(Form1.hWnd, CSIDL, IDL) = 0 Then
        sPath = Space$(MAX_PATH)
        If SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal sPath) Then
            fGetSpecialFolder = Left$(sPath, InStr(sPath, vbNullChar) 
- 1) & "\"
        End If
    End If
End Function


Private Sub Command1_Click()
    MsgBox fGetSpecialFolder(CSIDL_DESKTOP)
End Sub


Salam,
Agus Pradikta



--- In [email protected], "idris nugroho" <[EMAIL PROTECTED]> 
wrote:
>
> salam...
> 
> Sbg pemula mo mnta tlg nih, begini, ak mo simpan file gbr pake 
software VB menggunakan app.path & "\tes.bmp", nah masalahnya klo mo 
nyimpan di desktop komputer gmn yah (seperti shortcut yg di desktop).
> 
> mohon pencerahan dari senior.
> 
> trims,
> idris
> 
> -- 
> See Exclusive Video: 10th Annual Young Hollywood Awards
> http://www.hollywoodlife.net/younghollywoodawards2008/
>


Kirim email ke