When writing a software, click another simulation software interface, assuming click (after use mouse_event or SendMessage), should pop up a dialog box, how to determine this dialog pop up already?
Currently used method is to immediately find the window handle of the expected (FindWindow FindWindowEx), but if they don't wait a second after the search, still can't find that mistake, the boss think that this method is not stable, if on a low configuration machine would go wrong. Do you have any good idea?
CodePudding user response:
Baidu search, "call an external application background of perfect implementation (using CreateDesktop build hide desktop)"
CodePudding user response:
http://www.autohotkey.com
CodePudding user response:
reference 1st floor zhao4zhong1 response: baidu search "call an external application background of perfect implementation (using CreateDesktop build hide desktop)" Detected the corresponding link http://www.cnblogs.com/findumars/p/5236726.html still can't find the code assumes that the 30 seconds of the corresponding window is an error. It is feasible for the window of the inevitable. But I need to deal with a possible progress bar, if the progress bar will appear, then wait for the progress bar to complete, if the progress bar does not appear, do not continue to the next step, the problem is that, if wait for 30 seconds to determine the progress bar will not appear, the program efficiency is too low, if wait for a second or two, then progress bar itself may appear, but the waiting time is too short, the results don't think the progress bar will appear, skip the processing steps. Need a do not rely on and wait time method to solve this problem. CodePudding user response:
DLL injection?? CodePudding user response:
SendMessage is direct call WindowProc, therefore the SendMessage return is also indicates that the message has been processed for SendInput - keybd_event and mouse_event) simulation of the message is normal PostMess delivered to the message queue, so consider Hook WH_GETMESSAGE CodePudding user response:
Use SendMessage, CodePudding user response:
Process response when it is good to send a message to tell, or use global variables, response to a change of global variables, determine the variable in another process, CodePudding user response:
Cannot determine the CodePudding user response:
refer to the second floor zhao4zhong1 response: http://www.autohotkey.com Positive solution! CodePudding user response:
reference 4 floor VisualEleven response: DLL injection?? Using hook check messages should be feasible, to give it a try CodePudding user response:
I used image recognition, compare the pop-up regional image comparison CodePudding user response:
The reference 11 floor smwhotjay reply: I used image recognition, compare the pop-up regional image comparison This may be too complicated, it is no longer consider this way CodePudding user response:
refer to 7th floor chen_JADE response: process response time would be better to send a message to tell, or use global variables, response to a change of global variables, determine the variable in another process, If another program is good, others have written two programs were written yourself directly interprocess communication line CodePudding user response:
"One possible progress bar" This progress bar? Starting from the purpose of it? So write files, detect file changes, CodePudding user response:
Can try ValueProperty this event (https://docs.microsoft.com/en-us/dotnet/framework/ui-automation/ui-automation-support-for-the-progressbar-control-type) Usage is probably this Automation. AddAutomationPropertyChangedEventHandler (element, TreeScope Element, PropChangeHandler=new AutomationPropertyChangedEventHandler (OnPropertyChange), ValuePattern. ValueProperty); But you need to target program to support UI automation (for example, is to use Win32 controls/WPF, or MFC/Winforms wrapper class) CodePudding user response:
Upstairs is a great god CodePudding user response:
With this ready-made plug-in, The desert plug-in, Binding window - & gt; To find, find words, you can realize the function you want to, The plug-in usage is very simple, use baidu yourself, Look for the button you want, then find dialog box, for sure, For reference only Ret=dm. FindPic (0, 0, iWidth, iHeight, "button. BMP", "000000", 0.9, 2, & amp; X, & amp; Y); Ret=dm. FindPic (0, 0, iWidth, iHeight, "sure. BMP", "000000", 0.9, 2, & amp; X, & amp; Y); If (x.l Val & gt; 0 & amp; & Y.l Val) { Dm. MoveTo (x.l Val + 3, y.l Val + 3); MySleep (200); Dm. LeftClick (); break; } CodePudding user response:
"Immediately to find the desired window handle (FindWindow FindWindowEx), but if they don't wait a second after the search, still can't find that mistake, the boss think that this method is not stable, if on a low configuration machine would go wrong." Why don't understand why this method is not stable, why go wrong, FindWindow where this function is not can use? CodePudding user response:
Using FindWindow polling, is the most simple of Write a for loop, every 1 second query time, try again 30 times (or more) still can not find, do error handling CodePudding user response:
Summarizes the methods you, 1. FindWindow honesty waiting, waiting for the longest 30 seconds, for example, the solution efficiency is extremely low, if to appear in a window waiting for (such as update prompt window), and will probably wait for 30 seconds enough, if keep the 30 seconds, such as transferred to 3 seconds, then appeared for a certain window, probably because the CPU is busy, 3 seconds window cannot be mapped, lead to can't find the window need. 2. ValueProperty didn't consider this way, because want to control software is written by Delphi 3. The image recognition, it may be possible, but I don't have a try. 4. Hook finally adopted this method, after the hook can be interprocess communication, two equivalent to write your own program. CodePudding user response:
WinAPIOverride http://jacquelin.potier.free.fr/winapioverride32/