Tech Support > Microsoft Windows > Development Resources > SHBrowseForFolder - Callback Kills Scroll Bar.
SHBrowseForFolder - Callback Kills Scroll Bar.
Posted by Larry Lindstrom on May 26th, 2008


Hi Folks:

Developing on XP Home, VS 2008 Pro, WIN32, no MFC.

I've been using SHBrowseForFolder() for a long time, but
a user is telling me the dialog is too big to fit on their
screen. Perhaps because they are using Dragon Naturally
Speaking, which has it's own frame around the client area.

So I'm specifying a callback for SHBrowseForFolder.
This is the first time I've tried to use a callback for
this function.

The callback does seem to be able to specify a new size
for the browse folder, but the scroll bar, which was present
before the callback was used, is now gone.

How do I resurrect the scrollbar?

This is my callback:

int CALLBACK contact_import_brouwsinfo_callback(HWND hwnd,
UINT umsg,
LPARAM lparam,
LPARAM lpdata)
{
int return_val = 0;

switch(umsg)
{
case BFFM_INITIALIZED:

SetWindowPos(hwnd, HWND_TOP, 0, 0, 500, 500,
SWP_NOREPOSITION | SWP_NOZORDER);

break;

case BFFM_VALIDATEFAILED:

// There isn't an edit box, so this shouldn't happen.
// Return non-zero to keep the dialog displayed.
return_val = 1;

break;
}
return return_val;
}

For testing, this has a hard coded dialog size. Of
course, the production version will be more flexible.

Thanks
Larry

Posted by Christian ASTOR on May 26th, 2008


On 26 mai, 10:10, Larry Lindstrom <nob...@nowhere.com> wrote:
Use PostMessage() to call SetWindowPos() in a WM_USER + n message

Posted by Larry Lindstrom on May 26th, 2008


Christian ASTOR wrote:
Thanks again Christian:

And again, and again... You are really helping me a lot
reciently.

That works. I wonder why the dialog can't be set from the
callback.

Thanks
Larry


Similar Posts