日期:2014-05-19  浏览次数:20911 次

<请教大虾> 关于Windows消息值拦截...
请问系统绘制Winforms窗体按钮的消息值是什么???

绘制非客户区的消息是   ->   WM_NCPAINT:   0x0085

那么绘制窗体的最小/大化/还原、关闭、帮助按钮的系统消息分别又是什么呢???

它们是保存在Message对象的那个参数上???是LParam/RParam还是Msg呢???

希望知道的过客们分别把它们列出来...

以这种方式:   [Message的参数名]-> [英文名]-> [值]

谢谢...

------解决方案--------------------
系统在绘制标题上的元素的时候应该不是你所认为的那样.

在绘制标题的时候会发生的消息有WM_NCPAINT,系统在收到这个消息的时候按如下的规则来执行默认的方法:
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_NCPAINT
WPARAM wParam, // handle to update region (HRGN)
LPARAM lParam // not used
);

MSDN上的说明如下:
Parameters
wParam
Handle to the update region of the window. The update region is clipped to the window frame. When wParam is 1, the entire window frame needs to be updated.
lParam
This parameter is not used.
Return Values
An application returns zero if it processes this message.

Remarks
The DefWindowProc function paints the window frame.

An application can intercept the WM_NCPAINT message and paint its own custom window frame. The clipping region for a window is always rectangular, even if the shape of the frame is altered.

The wParam value can be passed to GetDCEx as in the following example.

case WM_NCPAINT:
{
HDC hdc;
hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);
// Paint into this DC
ReleaseDC(hwnd, hdc);
}

------解决方案--------------------
用SPY++能得到你想要的一切
------解决方案--------------------
WM_MINIMIZE = 0xF020
WM_MAXIMIZE = 0xF030
WM_CLOSE = 0x0010
WM_HELP = 0x0053
------解决方案--------------------
还有,按MSDN所说,lParam参数既然不用,那什么还要保留呢?不明白...

-------------------------
在Windows的系统中所有的事件都是由系统的消息来驱动的,归纳了所有的消息的特点后就总结出了一个Message的最简洁最合适的结构:
IntPtr hWnd
int msg
IntPtr wparam
IntPtr lparam

这个结构中的成员可能会在某些消息中用不到,但是这是包含消息内容最全的了.
------解决方案--------------------
关注一下...
------解决方案--------------------
这些你用spy++看以下就知道了,不用记.

如果想找列表的话WinDef.h