BOOL CDemoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
//删除WS_CAPTION和WS_BORDER风格
ModifyStyle(WS_CAPTION, 0);
ModifyStyle(WS_BORDER, 0);
//获得屏幕长度和高度
int cx = GetSystemMetrics(SM_CXSCREEN);
int cy = GetSystemMetrics(SM_CYSCREEN);
//设置对话框位置和大小
SetWindowPos(NULL, 0, 0 , cx, cy, SWP_NOZORDER);
CRect rect;
GetDlgItem(IDC_TEXT)->GetWindowRect(rect);
GetDlgItem(IDC_TEXT)->MoveWindow(cx / 2 - rect.Width() / 2, cy / 2, cx / 2, cy / 2);
return TRUE;
}