简体   繁体   English

按键进入非活动窗口

[英]Key Press to inactive window

Ima go cry now, I was doing 伊玛现在哭了,我在做

PostMessage(Spotify, WM_KEYDOWN, 0, VK_SPACE);
//instead of
PostMessage(Spotify, WM_KEYDOWN, VK_SPACE, 0);

It is fixed now tho. 它现在固定。

Without knowing anything about the window you are working with, I can only surmise that it is not coded to process keystrokes in its WndProc. 在不了解您正在使用的窗口的任何信息的情况下,我只能猜测它没有被编码为在其WndProc中处理键击。 You can use Spy++ or similar tool to verify that the messages are actually being sent, but that is no guarantee that they will be processed. 您可以使用Spy ++或类似工具来验证消息是否正在实际发送,但这不能保证将对它们进行处理。 You cannot send keystrokes to arbitrary windows that are not expecting them. 您不能将击键发送到不需要它们的任意窗口。 And BTW, keystroke messages are typically posted to a window's message queue, not sent directly to the window's WndProc, so try using PostMessage() instead. 顺便说一句,击键消息通常会发布到窗口的消息队列中,而不是直接发送到窗口的WndProc,因此请尝试使用PostMessage()代替。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM