How can I resize my CFrameWnd
-
I try to resize my CFrameWnd, but it doesn't work. Can anyone tell me the reason, thanks void CMyApp::OnAppAbout() { //here I want to resize and draw my framw window SendMessage(AfxGetMainWnd()->m_hWnd, WM_SIZE, SIZE_RESTORED, MAKELPARAM(50, 50)); AfxGetMainWnd()->ShowWindow(SW_SHOW); AfxGetMainWnd()->UpdateWindow(); }
-
I try to resize my CFrameWnd, but it doesn't work. Can anyone tell me the reason, thanks void CMyApp::OnAppAbout() { //here I want to resize and draw my framw window SendMessage(AfxGetMainWnd()->m_hWnd, WM_SIZE, SIZE_RESTORED, MAKELPARAM(50, 50)); AfxGetMainWnd()->ShowWindow(SW_SHOW); AfxGetMainWnd()->UpdateWindow(); }
-
Thank you for your advise. If I call SetWindowPos, it indeed does work. However, I feel very strange about why WM_SIZE message doesn't do any effect. Won't it redraw the frame after I resize it?
richardye wrote: However, I feel very strange about why WM_SIZE message doesn't do any effect. From MSDN: "The WM_SIZE message is sent to a window after its size has changed. " Did you mean to call the windows API function MoveWindow() (Or it's MFC wrapper equivalent)? CWnd* pWnd=AfxGetMainWnd(); if (pWnd) { CRect rect; pWnd->GetWindowRect(&rect); rect.right=rect.left+50; rect.bottom=rect.top+50; pWnd->MoveWindow(rect); }