tags:

views:

142

answers:

2

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?

+1  A: 

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;
}
Naaff
+1  A: 

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);
aJ
I personally think this is way better than placing the dialog in some awkward position.
djeidot