I thought this would be trivial, but after a lot of searching around MSDN,google,this forum's search etc I utterly failed !
Here is the situation, I create a dialog with these resource properties :
whatever DIALOGEX 300,150,196,165
FONT 8,"Tahoma",400,0,0
STYLE WS_POPUP+WS_VISIBLE
BEGIN
END
And I use this command to create it :
invoke DialogBoxParam, hInstance, ADDR DlgName,NULL,addr DlgProc,NULL
How can I set it to be created centered to the desktop/screen or as a last resort what's the best way to center it to the screen on init ?
You must calculate the postion yourself when processing WM_INITDIALOG message.
1.Get the screen size using GetSystemMetrics
2.Get the size of your window
3.Calculate the center position
4.Set the window position using SetWindowPos
+DS_CENTER
Quote from: drizz on August 29, 2008, 01:23:16 AM
+DS_CENTER
YES ! Thank you !
(http://www.freesmileys.org/smileys/bounce006.gif)
P.S.: Thanks hover for the info, I'll keep those APIs in mind.