Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Apr : How to center the SHBrowseForFolder?

www.cryer.info
Managed Newsgroup Archive

How to center the SHBrowseForFolder?

Subject:How to center the SHBrowseForFolder?
Posted by:"Mark Tiede" (mtie..@mjwcorp.com)
Date:Wed, 2 Apr 2008 09:42:29 -0400

This function produces a dialog that may not be centered.  I found code on
the net to do the centering.  This code is in the callbackprocedure and is
executed when the BFFM_INITIALIZED message comes in.  Now the problem.

If, when the dialog is visible, I resize it, it remembers that size.  But,
when the BFFM_INITIALIZED message comes in, the size of the window does not
yet include the "final" resized size.  It give me the initial size of the
dialog.  Consequently, the calculation of how to center it is wrong and the
top left corner is in the right spot for the original dialog size, but the
width is wrong.

I am getting the size of the dialog by calling GetWindowRect( hwnd, Rect )
where hwnd is the handle passed into the callback.

Any ideas?  Another event to do the calculation in?

Glossary

Replies:

www.cryer.info
Managed Newsgroup Archive