News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

SHBrowseForFolder + BIF_NEWDIALOGSTYLE

Started by Jimg, October 01, 2005, 01:11:09 AM

Previous topic - Next topic

Jimg

I just spent three days trying to get SHBrowseForFolder to behave.  I wanted to use the BIF_NEWDIALOGSTYLE setting so the user could resize the dialog.  Folder lists are quite extensive these days, and one of my pet peeves is a program that make you scroll through tons of stuff in a little window.   It all works quite well except for one problem.  SHBrowseForFolder remembers the size that the user last used for the dialog, but it doesn't remember the position, so if you open it up large to see lots of folders, the next time you run it, it's just as large, but starts in the middle of the screen, so the bottom half is off the screen.

No problem, I'll just remember where it was the last time and move it around in the callback.  Didn't work.  I had to subclass the dang thing, trap the position changes (with WM_EXITSIZEMOVE), so I always had the latest position.  On startup, I had to post a USER+ message to the dialog (to my subclassed code) to set the position after everything had settled down.  You have to also be careful to only change the position and not the size as it doesn't adjust the size of the treeview and move the button if you manually do a movewindow giving it a different size.

The question is, is there some simpler way to get it to remember the position of the dialog?  Does this happen on everyone's machine, or is it just mine that's screwed up?  Is this a bug?