Home > Software engineering > VS2010 VB how to write in the pop-up dialog box automatically determined?
VS2010 VB how to write in the pop-up dialog box automatically determined?
Time:09-19
Haven't touch VB (like before), now suddenly you need a small program, and it is real-time monitoring, let it help me to complete a small function:
How to help me to click on the pop-up dialog box automatically determine button? These requirements are the background completely, does not affect the normal mouse, keyboard operation (such as the Internet, entertainment, etc.)
CodePudding user response:
This has nothing to do with "platform"! A variety of programming environments, thinking about the same,
If it is in the "user action" pop-up message box, this news should be in the "front desk" active window, Can use GetForegroundWindow () to get the message box handle, And then to handle value "ok" button to find the handle, it is ok to send it WM_LBUTTONDBLCLK,
If it is a "daemon" operation, in some cases a message prompt, it shall pay the window class name, the window title for the window,
To achieve the so-called "real-time", one is to HOOK the window to create several related API (difficult), It can intercept window is created by "monitored" message box, how much is the handle value, Method 2, easy to implement, is to use "timer events," have you ever been monitoring window kept "find" (message box), If found (a), and then find it "ok" button on the handle, send the WM_LBUTTONDBLCLK message, , after all, in most cases, close the message box "" real-time demand is not high, as long as the timer clock cycle short point,
CodePudding user response:
In addition, if the message box is only "certain" that don't have to look "ok" button on the handle, directly to the WM_CLOSE message box sent to go,