[英]What is WM_KEYDOWN in c++
I'm new to c++ and wondering what "WM_KEYDOWN" is?我是 C++ 新手,想知道“WM_KEYDOWN”是什么? And how to use it.
以及如何使用它。
Thank you.谢谢你。
WM_KEYDOWN
is defined in Microsoft Docs : WM_KEYDOWN
在Microsoft Docs 中定义:
#define WM_KEYDOWN 0x0100
While I don't have a better explanation than Microsoft's, I'll post what the doc says:虽然我没有比微软更好的解释,但我会发布文档所说的内容:
Posted to the window with the keyboard focus when a nonsystem key is pressed.
当按下非系统键时,发布到具有键盘焦点的窗口。 A nonsystem key is a key that is pressed when the Alt key is not pressed.
非系统键是在未按下Alt键时按下的键。
Simply put, it is a value returned by Windows in a program when a key on the keyboard is pressed (and when Alt isn't).简单地说,它是当键盘上的某个键被按下时(当Alt没有按下时)由 Windows 在程序中返回的一个值。 The opposite is
WM_KEYUP
, which will be emitted when you release the key.相反的是
WM_KEYUP
,它会在您释放键时发出。
A message flag produced by your window when your key is pressed.按下键时窗口产生的消息标志。 You can use it in the message handler function like
您可以在消息处理函数中使用它,例如
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
Then register it to your WNDCLASS然后将其注册到您的 WNDCLASS
WNDCLASS ws;
ws.lpfnWndProc = WndProc;
See http://msdn.microsoft.com/en-us/library/gg153546(v=VS.85).aspx for more information about how to dual with WM_KEYDOWN in WndProc.请参阅http://msdn.microsoft.com/en-us/library/gg153546(v=VS.85).aspx以获取有关如何在 WndProc 中使用 WM_KEYDOWN 进行双重化的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.