Passing structures` flags to WinAPI32 functions from VB(VBA)

From: Serg (Serg_at_discussions.microsoft.com)
Date: 08/25/04


Date: Wed, 25 Aug 2004 13:05:03 -0700

Dear Sirs,
 
I`m trying to pass flags of BROWSEINFO structure from VBA code on
MsAccess2000.
In it I should declare each flag as numeric constant with hexanumeric value
like this:
 
Option Compare Database
Option Explicit
 
Private 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
 
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
            "SHGetPathFromIDListA" (ByVal pidl As Long, _
            ByVal pszPath As String) As Long
            
Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _
            "SHBrowseForFolderA" (lpBrowseInfo As BrowseInfo) _
            As Long
            
Private Const BIF_RETURNONLYFSDIRS = &H1
Private Const BIF_EDITBOX = &.....????
 
Sub Browse()
Call BrowseFolder("Please, select a folder...")
End Sub
 
Public Function BrowseFolder(szDialogTitle As String) As String
  Dim x As Long, bi As BrowseInfo, dwIList As Long
  Dim szPath As String, wPos As Integer
  
  With bi
      .hOwner = hWndAccessApp
      .lpszTitle = szDialogTitle
      .ulFlags = BIF_RETURNONLYFSDIRS
  End With
  
  dwIList = SHBrowseForFolder(bi)
  szPath = Space$(512)
  x = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)
  
  If x Then
      wPos = InStr(szPath, Chr(0))
      BrowseFolder = Left$(szPath, wPos - 1)
  Else
      BrowseFolder = ""
  End If
End Function

How can I get numeric value to flag BIF_EDITBOX or other flags? In
documentation of this structure it is not described.

Thank you for parcipitation



Relevant Pages

  • Re: File Dialog
    ... capture the path and place it on the control, ... pszDisplayName As String ... Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _ ... "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _ ...
    (microsoft.public.access.modulesdaovba)
  • Cancelling directory dialog box
    ... Private Type BrowseInfo ... Private Declare Function SHGetPathFromIDList Lib _ ... ByVal lpString2 As String) As Long ... Dim iNull As Integer ...
    (microsoft.public.excel.programming)
  • Re: File Input Question
    ... To have a user select a folder, not a file, I use the below. ... pszDisplayName As String 'Address of a buffer to receive the display name of the folder ... Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long ... Private Declare Function GetWindowRect Lib "user32" ...
    (microsoft.public.excel.programming)
  • Re: Selecting an initial directory
    ... Private Declare Function SHGetPathFromIDList Lib "shell32.dll" _ ... Alias "SHGetPathFromIDListA" _ ... ByVal pszPath As String) As Long ... Private Type BROWSEINFO ...
    (microsoft.public.excel.programming)
  • Re: link microsoft word title to a value in access
    ... pszDisplayName As String ... Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _ ... "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _ ... Dim X As Long, bi As BROWSEINFO, dwIList As Long ...
    (comp.databases.ms-access)