dcsimg

Setting the initial position of a dialog-based application

WEBINAR:
On-Demand

Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame


void CAppDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) { if (lpwndpos->cx = -1) if (lpwndpos->cy = -1) // is init time { lpwndpos->x = 0; // change here if you want to move left or right the window. lpwndpos->y = 0; // change here if you want to move top or bottom the window. } CDialog::OnWindowPosChanging(lpwndpos); }

Explanation

After CreateDialogIndirect, the MFC call CenterWindow. The last line of this function call SetWindowPos with position of window, and with -1, -1, as width and height of window. So the WM_WINDOWPOSCHANGING is obviously.

Date Last Updated: April 19, 1999



This article was originally published on April 19th, 1999

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date