1

I'm trying to include into my Dialog Window Procedure, that when the msg WM_CTLCOLORSTATIC is received that I get the ID of the Control that is sending the message.

case WM_CTLCOLORSTATIC: 
        UINT ID = GetWindowLong((HWND)lParam, GWL_ID);

Problem is... when I try to type-cast the lParam of WM_CTLCOLORSTATIC it returns the value 65535, which can't be correct; I don't even have a resource item with the maximum UINT ID 65535.

Can you give me any insight into why this is happening?

4

1 回答 1

5

您的问题不是很清楚,但我猜您的 ID 为 65535,即 -1,这是静态控件 ID 的标准。

如果您希望能够区分静态控件,请给它们不同的 ID。

如果您不关心其他静态控件的颜色,只需使用:

if ( ID ==  IDC_RECT_CC_00 ) {
    [...]
} else {
    // don't bother
}
于 2013-12-18T13:33:03.350 回答