BrowseForFolder Dialog doesn't work

Started by Dave Paton, January 02, 2012, 11:10:16 PM

Previous topic - Next topic

Dave Paton

I noticed this behavior in VB.Net (VS2008) and now it is happening again in FF3.51 and PB10.03. Anytime there is a BrowseForFolder dialog box and I have to click on it, as in defining the default folder where project files are to be stored, the dialog box appears just fine, but the cursor is an hourglass and the program just hangs forever at this point. I have to close FF or PB completely. With a reboot of WinXP SP3, the BrowseForFolder dialog will now work one time only, but basically I have to reboot the computer every other time I am forced to use a BFF Dialog box. Is there a workaround for this behavior? In VB6 or VB.net I just used a FileOpenDialog box and asked for folders. Worked great. When I figure out the equivalent in PB I'll post it. Even VB.Net users are split between whether the BFF Dialog is wothwhile using, so I was disappointed you have it almost as the first thing I have to check off in setting up a project.

Rolf Brandt

I use the BrowseForFolder dialog quite often. My environment is the same like yours:
Win XP Pro SP3
FF 3.51
PB 10.03

It gives me absolutely no problems. Not sure if that has to do with it, but did you check if you have the latest Josè Roca files installed?

Rolf
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

David Kenny

Dave,

You say your machine has exhibited this problem before.  Many of us use BFF, in FF and many other programs every day and this is the first time I can recall that somebody has mentioned this behavior.  I troubleshoot systems for a living and my gut feeling is that the problem likely exists only on your machine.  No offense meant, and I hope that none is taken.

David

Rolf Brandt

#3
I think you are right, David, especially since this occurs also under VS2008.

My shell.dll is version 6.0.2900.6072 dating from Jan 1st, 2011.
Shfolder.dll is version 6.0.2900.5512 dating from Apr 14th, 2008.

Maybe these aren't uptodate.

Rolf
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Dave Paton

Rolf, did you mean shell32.dll or shell.dll? My shell32.dll is version 6.0.2900.6072 but my shell.dll is 3.10.0.103 from 01 Jan 2001. On the net I can't find a version of shell.dll newer than 2002. This is the first forum that has actually given me any direction in this matter. MSDN was not helpfull at all and I just stopped using the BFF dialog. Even if I am able to fix the behavior on my computer, I will still use the FileOpen dialog to browse for folders in programs that I write. But not everyone feels the same way about BFF as I do so I have to be able to run their programs too.

Rolf Brandt

You are of course right, Dave - shell32.dll. I've got exactly the same versions like you.
Did you check Josè's files, it it is version 2.04?

Attached is a small FF3.51 project with two buttons. One uses FF_BrowseForFolder, the other one the PB Browse dialog. Both show the same results on my computers.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Dave Paton

Well, this is getting very interesting. Rolf, when I run your file it works fine, whether FF or PB BFF. Now when I run FF3.51 and try to open a new project, changing from the default directory for projects brings up a BFF dialog box and that particular one always hangs on this computer. Eventually I have to shut down the dialog box which ends the program, as if I had run Task Manager. So, what is different about your little BFF program and Paul's BFF box in FF? BTW, I am using version 2.05 of Jose's files, which just came out recently. I'm also wondering if I am getting a conflict between shell.dll and shell32.dll. I have no idea where shell.dll came from as it is a 16 bit dll. I thought it might be from VB6, but on my Win7 computer I have VB6 and no shell.dll. I guess I could try to delete or rename shell.dll and see if that fixes the apparent conflict and maybe down the line I might even find the offender by getting an error message from some program that is looking for shell.dll.

Rolf Brandt

I think shell.dll is only for compatibility reasons there.

Rolf
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Dave Paton

I'd still like to know what's different about your BFF and the one in FF when you open a project or use it from Environment Options. The BFF dialog in FF will only run once or twice after a reboot, whereas your BFF dialog works every time, even when the same dialog hangs in FF. I just had to reboot to change the default project directory in FF, so everything is working fine at the moment. I renamed shell.dll in System32 and hopefully I might be able to find which program wants the older version of shell.

Rolf Brandt

What happens if you recompile my project? Does it still work? Or does only the one I compiled run?

Rolf
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

José Roca

This thread has given me an idea for a new wrapper function that I'm going to include in AfexShell.inc.


' ========================================================================================
' Displays a dialog box that enables the user to select a Shell folder.
' Paramaters:
' - hwnd       = The handle to the parent window of the dialog box. This value can be zero.
' - bstrTitle  = A String value that represents the title displayed inside the Browse dialog box.
' - Options    = Optional. A LONG value that contains the options for the method. This can be zero or a
'                combination of the values listed under the ulFlags member of the BROWSEINFO structure.
'                See: http://msdn.microsoft.com/en-us/library/windows/desktop/bb773205%28v=vs.85%29.aspx
' - RootFolder = Optional. The root folder to use in the dialog box. The user cannot browse
'                higher in the tree than this folder. If this value is not specified, the
'                root folder used in the dialog box is the desktop. This value can be a
'                string that specifies the path of the folder or one of the
'                ShellSpecialFolderConstants values.
'                See: http://msdn.microsoft.com/en-us/library/windows/desktop/bb774096%28v=vs.85%29.aspx
' Return Value:
'   The path of the selected folder.
' ========================================================================================
FUNCTION AfxShellBrowserForFolder (BYVAL hwnd AS DWORD, BYVAL bstrTitle AS WSTRING, OPTIONAL BYVAL Options AS LONG, OPTIONAL BYVAL RootFolder AS VARIANT) AS WSTRING
   LOCAL pShell AS IShellDispatch
   pShell = NEWCOM "Shell.Application"
   IF ISNOTHING(pShell) THEN EXIT FUNCTION
   LOCAL pFolder AS ShellFolder2
   pFolder = pShell.BrowseForFolder(hwnd, bstrTitle, Options, RootFolder)
   IF ISNOTHING(pFolder) THEN EXIT FUNCTION
   LOCAL pItem AS ShellFolderItem
   pItem = pFolder.Self
   IF ISNOTHING(pItem) THEN EXIT FUNCTION
   FUNCTION = pItem.Path
END FUNCTION
' ========================================================================================


Usage example:


#COMPILE EXE
#DIM ALL
#INCLUDE ONCE "AfxShell.inc"

FUNCTION PBMAIN () AS LONG

   LOCAL bstrPath AS WSTRING
   bstrPath = AfxShellBrowserForFolder(0, "Test", 0, %ssfWINDOWS)
   ? bstrPath

END FUNCTION


Wilko Verweij

Dave,
Can you post an example of a program that locks your computer? Source with executable? The smaller (source), the better.
Wilko

Rolf Brandt

Hi, Josè,

it had surprised me already that there wasn't any. I had checked your wrappers before.

Rolf
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

José Roca

Quote
it had surprised me already that there wasn't any. I had checked your wrappers before.

Me too :) I thought that I already had one.

Dave Paton

When I recompile your program, Rolf, it still works fine and both versions of BFF work as expected. Wilko, as far as a program that locks up, I haven't written one, but Paul Squires has and it's called FireFly 3.51. Of course, now, my computer is behaving badly and any BFF dialog box I open is working just fine, whether it be Rolf's or Paul's. All I did was rename shell.dll to shell.old.dll in system32 and everything seems to be fine. Computers are very frustrating when you don't think you've done much and all of a sudden they start working as expected. So, for the time being, my problem is solved. Thanks to everyone for their help. :)