Bạn có thể bắt sự kiến nhấn các nút Minimize, Maxmize thông qua WM_SIZE Notification
WM_SIZE Notification
The WM_SIZE message is sent to a window after its size has changed.
A window receives this message through its WindowProc function.
Syntax
WM_SIZE
WPARAM wParam
LPARAM lParam;
Parameters
wParam
Specifies the type of resizing requested. This parameter can be one of the following values.
SIZE_MAXHIDE
Message is sent to all pop-up windows when some other window is maximized.
SIZE_MAXIMIZED
The window has been maximized.
SIZE_MAXSHOW
Message is sent to all pop-up windows when some other window has been restored to its former size.
SIZE_MINIMIZED
The window has been minimized.
SIZE_RESTORED
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.
Return Value
If an application processes this message, it should return zero
Xem thêm tại đây :http://msdn2.microsoft.com/en-us/library/ms632646.aspx
Ví dụ , bạn bắt sự kiện click Minimize button ,biến nó thành Close button :
PHP Code:
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_SIZE:
switch(wParam)
{
case SIZE_MINIMIZED:
PostQuitMessage(0);
break;
}
return (0);
case WM_CREATE:
return (0);
case WM_PAINT:
return (0);
case WM_DESTROY:
PostQuitMessage (0);
return (0);
}
return DefWindowProc (hwnd, message, wParam, lParam);
}