c++ - Finding BUTTON of another program -


I am trying to click on my program to program another program. The issue I'm having problems with is identifying button handles. This is my code so far:

  Bull Callback EnumChildProc (HWND Window Handle, LPARAM lParam) {cout & lt; & Lt; "hwnd_Child =" & lt; & Lt; WindowHandle & lt; & Lt; Endl; Cout & lt; & Lt; "Window id:" & lt; & Lt; GetWindowLongPtr (window handles, GWLP_ID) & lt; & Lt; Endl; Return TRUE; } HWND windowHandle = searchwidth (tap, "name of program window"); EnumChildWindows (Window Handle, EnumChildProc, 0);   

What is happening so far that I'm getting the handle of the original window of the program. With that handle, I use the EnumChildWindows function to go through every child's windows ... and in 1 of those hair windows I will have three buttons, out of which I want to press 1 button. In the callback function, I have to add the GetWindowLongPtr () function to get the window ID. I ... Here is a problem ...

The problem is that every time I leave this program is again , The handle and the window id will change in which the buttons are included ... then I can not use the Spy + + to get the ID to compare with the ID ID after using the ID. I also tested it (this is because I have all "cout" codes);

Question: How do I identify the call again which I callback function (and possibly looking for button I) ??? Please do not allow Spy ++ to say, whenever I open the program, then the ID and handle value change

< p> The handle is always every time the code changes the going is going to change. Windows provides dynamically handles You or some other person can not do anything about it. It is more surprising if it changes not

And it is not a special conspiracy that the only way to change the control ID is the same, if it is a hard code in the original application, then possibly through the use of a resource file. But if the programmers dynamically control run-time, then there is no reason that they will need to use the same ID, just so long as they provide that ID in any type of data structure and if they If it is needed, then do track.

You can get the second asset of the button control which is the title of the constant. But this is definitely not a guarantee. Many programs change captions to reflect the current program.

The application developer has no obligation to make any program easy for any other program that is not related to them.

Have you considered using it correctly?

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -