简体   繁体   English

如何在后台修复窗口?

[英]how to fix window in background?

I want to make that window doesn't become foreground while execute postmessage(). 我想使该窗口在执行postmessage()时不会成为前台。 But, while execute program, window become foreground. 但是,在执行程序时,窗口成为前台。

point = (x,y);
lParam = makePararm(x,y);
PostMessage(hWnd, WM_LBUTTONDOWN, MK_LBUTTON, lParam);
sleep(0.03);
PostMessage(hWnd, WM_LBUTTONUP, MK_LBUTTON, lParam);

This program is that click x,y. 该程序是单击x,y。 I want to click window in background (not become foreground!) Could someone please help? 我想在后台单击窗口(不成为前台!)有人可以帮忙吗?

You are sending a mouse message to the window, as if the user is clicking the mouse. 您正在向窗口发送鼠标消息,就像用户单击鼠标一样。 The receiving application cannot differentiate between this, it just thinks you clicked it with the mouse and so it decides to get activated. 接收应用程序无法对此进行区分,它只是认为您用鼠标单击了它,因此决定激活它。

When the application you send the message to is yours (and you have the source of it), you can let it handle a custom message and send that message instead. 当您将消息发送到的应用程序是您自己的(并且有消息的来源)时,您可以让它处理自定义消息并发送该消息。

Now you are just simulating a mouse click. 现在,您只是在模拟鼠标单击。

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

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