winzip icon

Browse Folder or Computer or File or Printer using Windows original form. Purely API based.

Submitted on: 2/15/2015 5:59:00 PM
By: Amol Tarte (from psc cd)  
Level: Advanced
User Rating: By 3 Users
Compatibility: VB 5.0, VB 6.0
Views: 1146
     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!


Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'Windows API/Global Declarations for :Browse Folder or Computer or File or Printer using Windows original form. Purely API based.
Option 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
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_EDITBOX As Long = &H10
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 BFFM_INITIALIZED As Long = 1
Public Const BFFM_SETSELECTIONA As Long = (WM_USER + 102)
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net

Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

7/11/2017 9:15:24 AMRob

Excellent submission.
No dependencies
Do you have other projects to share ?
PS I tried to give you a 5 rating, but the rating form's Verification Code image is blank, so I cannot vote.
I am using Firefox 52.2.1 32bit

(If this comment was disrespectful, please report it.)


Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.