0

How can i make a mouse click with code? Basicly what I need is to, that the program could find "Class" or "Id" of a button, in MY made browser, and if the code finds required Class or Id the code would press it?

Lasinys
  • 1
  • 4
  • This is a duplicate of so many other questions it's hard to know which one to choose. Search this site for `[c++][winapi] mouse click`, or read this [answer](http://stackoverflow.com/q/28386029/62576) (the question is closed, or I'd use it as the duplicate). Search for `[winapi] find window` for locating the class or ID of a control. – Ken White Feb 25 '15 at 18:51

1 Answers1

0

One way would be something like:

FindWindow to get a handle to "MY made browser"'s window.

EnumChildWindows recursively to iterate through, checking the class with GetClassName.

PostMessage to post a WM_LBUTTONDOWN message to your found button.

Worth mentioning: there are existing tools that do this kind of thing. Squish is one that I know of, but I'm sure a quick google will find more if you want.

parrowdice
  • 1,902
  • 15
  • 24