Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Sent to a window after its size has changed.
A window receives this message through its WindowProc function.
#define WM_SIZE 0x0005
wParam
The type of resizing requested. This parameter can be one of the following values.
Value | Meaning |
---|---|
|
Message is sent to all pop-up windows when some other window is maximized. |
|
The window has been maximized. |
|
Message is sent to all pop-up windows when some other window has been restored to its former size. |
|
The window has been minimized. |
|
The window has been resized, but neither the SIZE_MINIMIZED nor SIZE_MAXIMIZED value applies. |
lParam
The low-order word of lParam specifies the new width of the client area.
The high-order word of lParam specifies the new height of the client area.
Type: LRESULT
If an application processes this message, it should return zero.
/******************************************************************
* *
* SimpleText::OnResize *
* *
* If the application receives a WM_SIZE message, this method *
* resize the render target appropriately. *
* *
******************************************************************/
void SimpleText::OnResize(UINT width, UINT height)
{
if (pRT_)
{
D2D1_SIZE_U size;
size.width = width;
size.height = height;
pRT_->Resize(size);
}
}
LRESULT CALLBACK SimpleText::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
SimpleText *pSimpleText = reinterpret_cast<SimpleText *>(
::GetWindowLongPtr(hwnd, GWLP_USERDATA));
if (pSimpleText)
{
switch(message)
{
case WM_SIZE:
{
UINT width = LOWORD(lParam);
UINT height = HIWORD(lParam);
pSimpleText->OnResize(width, height);
}
return 0;
// ...
Example from Windows classic samples on GitHub.
If the SetScrollPos or MoveWindow function is called for a child window as a result of the WM_SIZE message, the bRedraw or bRepaint parameter should be nonzero to cause the window to be repainted.
Although the width and height of a window are 32-bit values, the lParam parameter contains only the low-order 16 bits of each.
The DefWindowProc function sends the WM_SIZE and WM_MOVE messages when it processes the WM_WINDOWPOSCHANGED message. The WM_SIZE and WM_MOVE messages are not sent if an application handles the WM_WINDOWPOSCHANGED message without calling DefWindowProc.
Requirement | Value |
---|---|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
Minimum supported server |
Windows 2000 Server [desktop apps only] |
Header |
|
Reference
Conceptual
Other Resources
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!