I have an MFC application that creates a CDialog. I'd like this CDialog to not show up in the middle of the screen, but rather off to the side of the screen so its barely visible or even minimized would be good.
How can I do this?
I have an MFC application that creates a CDialog. I'd like this CDialog to not show up in the middle of the screen, but rather off to the side of the screen so its barely visible or even minimized would be good.
How can I do this?
Use SetWindowPos
in your OnInitDialog()
function, like so:
BOOL CDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// (x,y) is the upper-left corner in screen coordinates
SetWindowPos( NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER );
return TRUE;
}
You can use SW_SHOWMINIMIZED
flag in ShowWindow(SW_SHOWMINIMIZED)
. (SW_SHOWMINIMIZED ==> Opens the window in its minimized state, representing it as a button on the taskbar)
pDlg->Create(IDD_DLG_ID1,this);
pDlg->ShowWindow(SW_SHOWMINIMIZED);