改变窗口大小(像素):
使窗口变为800*600
(方法一)
MoveWindow(0, 0, 800, 600);
(方法二)
CRect rect(0, 0, 800, 600);
this->SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_NOMOVE);
注解:
Modifies the window styles of the CWindow object. Styles to be added or removed can be combined by using the bitwise OR ( | ) operator. See theCreateWindow function in the Win32 SDK for information about the available window styles.
If nFlags is nonzero, ModifyStyle calls the Win32 function SetWindowPos, and redraws the window by combining nFlags with the following four flags:
- SWP_NOSIZE Retains the current size.
- SWP_NOMOVE Retains the current position.
- SWP_NOZORDER Retains the current Z order.
- SWP_NOACTIVATE Does not activate the window.