Option Explicit
Public Enum Enum_Folder
CSIDL_DESKTOP = &H0
CSIDL_PROGRAMS = &H2
CSIDL_CONTROLS = &H3
CSIDL_PRINTERS = &H4
CSIDL_PERSONAL = &H5 '--------------> ini u. mencari folder my document nya current user
CSIDL_FAVORITES = &H6
CSIDL_STARTUP = &H7
CSIDL_RECENT = &H8
CSIDL_SENDTO = &H9
CSIDL_BITBUCKET = &HA
CSIDL_STARTMENU = &HB
CSIDL_DESKTOPDIRECTORY = &H10
CSIDL_DRIVES = &H11
CSIDL_NETWORK = &H12
CSIDL_NETHOOD = &H13
CSIDL_FONTS = &H14
CSIDL_TEMPLATES = &H15
End Enum
Private Type ITEMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As ITEMID
End Type
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
Public Function GetSpecialfolder(CSIDL As Enum_Folder) As String
Dim R As Long
Dim IDL As ITEMIDLIST
'Get the special folder
' On Error GoTo GetSpecialfolder_Error
R = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If R = 0 Then
'Create a buffer
Dim Path As String
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 = ""
' On Error GoTo 0
' Exit Function
'GetSpecialfolder_Error: pPrintError "GetSpecialfolder"
End Function
Debug.Print GetSpecialfolder(CSIDL_PERSONAL)
End Sub
dear all,mohon maaf mau numpang tanya lagikira2 bagaimana ya caranya supaya kita tahu alamat system path windows (c:\windows) scr coding VBjg klo di XP/2000, ada ngga yg tahun caranya kita tahu alamat dr local folder (c:\documents and settings\user1\my documents)makasih buat pencerahannya
Wahana Programmer Groups Links
<*> Untuk mengunjungi sponsor milis ini, klik link berikut:
http://wahanaprogrammer.net
<*> Untuk menghubungi owner milis ini, kirim email ke:
[EMAIL PROTECTED]
<*> Konsultasi pemrogramman bisa chat disini:
Yahoo! Messenger: wahanaprogrammer
| Programmer | Indonesia | Basic programming language |
| Computer programming languages | Programming languages | Java programming language |
YAHOO! GROUPS LINKS
- Visit your group "Programmer-VB" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
