Archived

This topic is now archived and is closed to further replies.

C++ Positioning A Dialog Box

Recommended Posts

In C++, I have a Modal Dialog Box that is brought up when the user selects a Menu option. The Dialog Box appears in the middle of the screen. I want to position it in the upper left or upper right corner of the frame window, but the various functions I have tried require a pointer that I just can''t seem to figure out how to obtain. Anyone have any examples they are willing to share? Thanks. My email address is: cgodfrey7@hotmail.com

Share on other sites
Skibum    122
  // all you will need is a handle to the dialog(i used hDlg),// and the x and y position of where you want the window to beSetWindowPos(hDlg, HWND_TOP, x-placement, y-placement, 0, 0, SWP_NOSIZE);

Share on other sites
EddieCai    122
try this.
CWnd::SetWindowPos
BOOL SetWindowPos( const CWnd* pWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags );
Any customer dialog derives CWnd.

Share on other sites
I thank you for your reply. I have tried using SetWindowPos and I am unable to get the first parameter correct.
I do not know how to get a handle to the dialog box, assuming that is what I am supposed to use as the first parameter. I could use a working example, if you have the time. Thanks.