[comp.windows.ms.programmer] Positioning a Dialog Box

kevino@pollux.svale.hp.com (Kevin Owen) (04/17/91)

How can I display a dialog box at a position that I specify at run time?  It
seems that the dialog editor hard codes an X and Y location.  Is there any
way to override these values?  Word for Windows and other windows apps 
display dialog boxes centered on the screen.  How do they do that??

Regards,

_______________________________________________________________________________

 _   ,                   __                 Kevin Owen @ Hewlett-Packard
' ) /                   / ')                Sunnyvale, California
 /-<   _ , __o  ____   /  / , , , _  ____   Phone :    (408) 720-3845
/   ) </_\/ <__/ / <  (__/ (_(_/_</_/ / <_  UN*X Mail  ...hplabs!hpcc01!kevino
_______________________________________________________________________________

hmolotsi@pollux.svale.hp.com (Hugh Molotsi) (04/18/91)

RE: How to re-position a dialog box at run time.

In your dialog box handler, when processing the WM_INITDIALOG message,
use the function:

	SetWindowsPos(hDlg, 0, xPos, yPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER);

where xPos and yPos are the new dialog box coordinates.


------------------------------------------------------------------------------
How you gonna do it? You gonna OS/2 it!

bonneau@hyper.hyper.com (Paul Bonneau) (04/18/91)

In article <7850002@pollux.svale.hp.com> kevino@pollux.svale.hp.com (Kevin Owen) writes:
>How can I display a dialog box at a position that I specify at run time?  It
>seems that the dialog editor hard codes an X and Y location.  Is there any
>way to override these values?  Word for Windows and other windows apps 
>display dialog boxes centered on the screen.  How do they do that??
>
When your dialog proc gets the WM_INITDIALOG message, use
MoveWindow() to position it to the desired location.

cheers - Paul Bonneau.