Databases Reference
In-Depth Information
Function BrowseCallBackFuncAddress() As Long
BrowseCallBackFuncAddress = Long2Long(AddressOf
BrowseCallBackFunc)
End Function
It is not possible to assign the result of AddressOf (which is a Long) directly to a member
of a user defined data type. This explicitly “converts” it to a Long and allows the assignment
Function Long2Long(X As Long) As Long
Long2Long = X
End Function
'Centers dialog on desktop
Sub CenterDialog(hwnd As Long)
Dim WinRect As RECT, ScrWidth As Integer, ScrHeight As Integer
Dim DlgWidth As Integer, DlgHeight As Integer
GetWindowRect hwnd, WinRect
DlgWidth = WinRect.Right - WinRect.Left
DlgHeight = WinRect.Bottom - WinRect.Top
ScrWidth = GetSystemMetrics(SM_CXFULLSCREEN)
ScrHeight = GetSystemMetrics(SM_CYFULLSCREEN)
MoveWindow hwnd, (ScrWidth - DlgWidth) / 2, (ScrHeight -
DlgHeight) / 2, DlgWidth, DlgHeight, 1
End Sub
To include Browse for Folder in your project, copy the above code into a single module in
your project.
The following function allows the Browse for Directory parameters to be easily set
Function SteroidBrowse(ByVal initialpath$, ByVal
AllowDirectEntry As Boolean, ByVal ValidateEntry As Boolean, _
ByVal ShowStatusText As Boolean, ByVal ShowFilesToo As Boolean,
ByVal UseNewDialogStyle As Boolean, _
ByVal CenterOnScreen As Boolean) As String
'Set up Browse Options via Boolean Flags
Dim RetStr As String, Flags As Long, DoCenter As Boolean
Flags = BIF_RETURNONLYFSDIRS
If AllowDirectEntry = True Then
Flags = Flags + BIF_EDITBOX
End If
If ValidateEntry = True Then
Flags = Flags + BIF_VALIDATE
End If
If ShowStatusText = True Then
Flags = Flags + BIF_STATUSTEXT
End If
If ShowFilesToo = True Then
Flags = Flags + BIF_BROWSEINCLUDEFILES
End If
Search WWH ::




Custom Search