http://www.huidong.xyz/?mode=2&id=148 这里面也用到了中途监听消息,再传回原来的消息响应函数。
WNDPROC OldProc = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC); // 得到原来的消息响应函数
SetWindowLong(hWnd, GWL_WNDPROC, (LONG)NewProc); // 设置现在的消息响应函数
// 响应消息
LRESULT CALLBACK NewProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int WndWidth;
int WndHeight;
switch (message)
{
case WM_SIZE:
WndWidth = LOWORD(lParam);
WndHeight = HIWORD(lParam);
break;
default:
return CallWindowProc(OldProc, hWnd, message, wParam, lParam); // 调用一个消息响应函数
break;
}
return 0;
}