by Dan East » Feb 22, 2002 @ 6:28am
Okay, now I see what you are trying to do. Here's the docs for WM_NCACTIVATE:
WM_NCACTIVATE
The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed to indicate an active or inactive state.
A window receives this message through its WindowProc function.
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_NCACTIVATE
WPARAM wParam, // new state (BOOL)
LPARAM lParam // not used
);
Parameters
wParam
Specifies when a title bar or icon needs to be changed to indicate an active or inactive state. If an active title bar or icon is to be drawn, the wParam parameter is TRUE. It is FALSE for an inactive title bar or icon.
lParam
This parameter is not used.
Return Values
When the wParam parameter is FALSE, an application should return TRUE to indicate that the system should proceed with the default processing, or it should return FALSE to prevent the title bar or icon from being deactivated. When wParam is TRUE, the return value is ignored.
Remarks
The DefWindowProc function draws the title bar or icon title in its active colors when the wParam parameter is TRUE and in its inactive colors when wParam is FALSE.
So, if you receive WM_NCACTIVATE with wParam==FALSE, then PostMessage a WM_CLOSE to your main hwnd.
Dan East