by Amol Tarte (1 Submission)
Category: Coding Standards
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating:
(4 Votes)

Ever wanted to use the Windows original form for selecting printer / computer / folder or file? No need to create your own form. No need of any control such as drive list box, Folder List Box etc. This one is for you. Try it, purely API based.
Vote if you think that it may be useful for you at some stage!
Thanks!
API DeclarationsOption Explicit
Public Declare Function SHBrowseForFolder Lib "shell32.dll" (ByRef lpbi As BROWSEINFO) As Long
Public Declare Function LocalAlloc Lib "kernel32" (ByVal uFlags As Long, ByVal uBytes As Long) As Long
Public Declare Function LocalFree Lib "kernel32" (ByVal hMem As Long) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As Any, pSource As Any, ByVal dwLength As Long)
Public Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Public Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal pv As Long)
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Public Const BIF_NEWDIALOGSTYLE As Long = &H40
Public Const BIF_BROWSEFORCOMPUTER As Long = &H1000
Public Const BIF_BROWSEFORPRINTER As Long = &H2000
Public Const BIF_BROWSEINCLUDEFILES As Long = &H4000
Public Const BIF_BROWSEINCLUDEURLS As Long = &H80
Public Const BIF_DONTGOBELOWDOMAIN As Long = &H2
Public Const BIF_EDITBOX As Long = &H10
Public Const BIF_RETURNFSANCESTORS As Long = &H8
Public Const BIF_RETURNONLYFSDIRS As Long = &H1
Public Const BIF_SHAREABLE As Long = &H8000
Public Const BIF_STATUSTEXT As Long = &H4
Public Const BIF_USENEWUI As Long = &H40
Public Const BIF_VALIDATE As Long = &H20
Public Const MAX_PATH As Long = 260
Public Const WM_USER = &H400
Public Const LMEM_FIXED = &H0
Public Const LMEM_ZEROINIT = &H40
Public Const LPTR = (LMEM_FIXED Or LMEM_ZEROINIT)
Public Const BFFM_INITIALIZED As Long = 1
Public Const BFFM_SETSELECTIONA As Long = (WM_USER + 102)
Download Browse Folder or Computer or File or Printer using Windows original form. Purely API based. (22 KB)
No comments have been posted about Browse Folder or Computer or File or Printer using Windows original form. Purely API based.. Why not be the first to post a comment about Browse Folder or Computer or File or Printer using Windows original form. Purely API based..