这些WndProc代码是什么意思?

时间:2022-03-10 21:05:16

I'm trying to make a window that closes when you click outside it, and at the moment I'm looking into doing that by handling the WndProc function.

我正在尝试创建一个窗口,当您在外部单击时关闭,此时我正在考虑通过处理WndProc函数来完成此操作。

None of the messages I'm getting so far seem useful, but there are a few I don't understand at all. What do codes 0x0118, 0xC123, 0xC128 and 0xC12E represent?

到目前为止,我所获得的消息似乎都没有用,但有一些我根本不理解。代码0x0118,0xC123,0xC128和0xC12E代表什么?

2 个解决方案

#1


4  

0x0118: WM_SYSTIMER (undocumented) used for caret blinks

0x0118:用于插入符号闪烁的WM_SYSTIMER(未记录)

The other three should be application defined messages (anything in the range 0xC000 to 0xFFFF) so you won't find those defined anywhere.

其他三个应该是应用程序定义的消息(0xC000到0xFFFF范围内的任何内容),因此您将无法找到任何定义的消息。

#2


2  

An easy way would be to just capture the mouse. When you have the mouse captured you get one click event outside your window, then capturing is turned off.

一种简单的方法就是捕获鼠标。捕获鼠标后,您可以在窗口外单击一次,然后关闭捕获。

A harder way would be to set a low-level mouse windows hook. To do a global hook, you'll have to put your hook code in an unmanaged DLL.

更难的方法是设置一个低级别的鼠标窗口挂钩。要执行全局钩子,您必须将钩子代码放在非托管DLL中。

A really easy way would be to just close your form when it's deactivated.

一个非常简单的方法就是在停用时关闭表单。

EDIT:

Oops. I just realized I didn't answer your direct question about the message IDs. Message 0x118 is not defined in winuser.h, so I assume it's an undocumented message ID. Message IDs in the range 0xC000 to 0xFFFF are application-defined messages. These IDs are returned by RegisterWindowMessage.

哎呀。我刚刚意识到我没有回答你关于消息ID的直接问题。消息0x118未在winuser.h中定义,因此我假设它是未记录的消息ID。 0xC000到0xFFFF范围内的消息ID是应用程序定义的消息。这些ID由RegisterWindowMessage返回。

#1


4  

0x0118: WM_SYSTIMER (undocumented) used for caret blinks

0x0118:用于插入符号闪烁的WM_SYSTIMER(未记录)

The other three should be application defined messages (anything in the range 0xC000 to 0xFFFF) so you won't find those defined anywhere.

其他三个应该是应用程序定义的消息(0xC000到0xFFFF范围内的任何内容),因此您将无法找到任何定义的消息。

#2


2  

An easy way would be to just capture the mouse. When you have the mouse captured you get one click event outside your window, then capturing is turned off.

一种简单的方法就是捕获鼠标。捕获鼠标后,您可以在窗口外单击一次,然后关闭捕获。

A harder way would be to set a low-level mouse windows hook. To do a global hook, you'll have to put your hook code in an unmanaged DLL.

更难的方法是设置一个低级别的鼠标窗口挂钩。要执行全局钩子,您必须将钩子代码放在非托管DLL中。

A really easy way would be to just close your form when it's deactivated.

一个非常简单的方法就是在停用时关闭表单。

EDIT:

Oops. I just realized I didn't answer your direct question about the message IDs. Message 0x118 is not defined in winuser.h, so I assume it's an undocumented message ID. Message IDs in the range 0xC000 to 0xFFFF are application-defined messages. These IDs are returned by RegisterWindowMessage.

哎呀。我刚刚意识到我没有回答你关于消息ID的直接问题。消息0x118未在winuser.h中定义,因此我假设它是未记录的消息ID。 0xC000到0xFFFF范围内的消息ID是应用程序定义的消息。这些ID由RegisterWindowMessage返回。