|
-
Jul 23rd, 2007, 11:52 AM
#1
Thread Starter
Addicted Member
Make SHBrowseForFolder Modal?
Is it possible to make the SHBrowseForFolder window modal?
-
Jul 23rd, 2007, 12:44 PM
#2
Re: Make SHBrowseForFolder Modal?
Yes, the UDT BROWSEINFO has a variable named hWndOwner (Long), it should be the first variable in the UDT. Assign your Form's Hwnd to this variable and the Dialog will be modal to your Form.
-
Jul 23rd, 2007, 02:43 PM
#3
Thread Starter
Addicted Member
Re: Make SHBrowseForFolder Modal?
 Originally Posted by jcis
Yes, the UDT BROWSEINFO has a variable named hWndOwner (Long), it should be the first variable in the UDT. Assign your Form's Hwnd to this variable and the Dialog will be modal to your Form.
Hmm
I get error: "Function or interface is marked as restricted, or the function uses an Automation type no supported in Visual Basic"
and it highlights the red part of this line:
frmMain.hWnd = myBI.hWndOwner
Might be because I'm calling this function from a module instead of on the form where it is being used.?
-
Jul 23rd, 2007, 04:42 PM
#4
Addicted Member
Re: Make SHBrowseForFolder Modal?
hi, i tried BrowseInfo.hwndOwner = Me.hwnd, it works
Code:
Private Const BIF_RETURNONLYFSDIRS = 1
Private Const BIF_DONTGOBELOWDOMAIN = 2
Private Const MAX_PATH = 260
Private Declare Function SHBrowseForFolder Lib "shell32" _
(lpBI As BrowseInfo) As Long
Private Type BrowseInfo
hwndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Private Function BrowseFolder()
Dim lpIDList As Long
Dim sbuffer As String
Dim szTitle As String
Dim tBrowseInfo As BrowseInfo
szTitle = "Choose PrLr Scheduler Sound Folder"
With tBrowseInfo
.hwndOwner = Me.hwnd
.lpszTitle = lstrcat(szTitle, "")
.ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN
End With
lpIDList = SHBrowseForFolder(tBrowseInfo)
If (lpIDList) Then
sbuffer = Space(MAX_PATH)
SHGetPathFromIDList lpIDList, sbuffer
sbuffer = Left(sbuffer, InStr(sbuffer, vbNullChar) - 1)
BrowseFolder = sbuffer
End If
End Function
-
Jul 23rd, 2007, 07:02 PM
#5
Thread Starter
Addicted Member
Re: Make SHBrowseForFolder Modal?
 Originally Posted by xavierjohn22
hi, i tried BrowseInfo.hwndOwner = Me.hwnd, it works
Ah I see. I had it backwards. Thx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|