Using visual studio's spy++ tool:

后端 未结 2 1308
刺人心
刺人心 2020-12-21 10:39

I am trying to make a program that will click the button of another program. I have been informed that I need to use spy++ in order to get the ID of the button that I want t

相关标签:
2条回答
  • 2020-12-21 11:06

    You have to look in the properties of the button, not in the properties of the parent window (at low level buttons are in fact some special kind of windows).

    0 讨论(0)
  • 2020-12-21 11:18

    After you use Spy -> Find Window, select button you are interested in with Finder Tool:, make sure that Show Properties is selected, then press OK. On General tab you will see Control ID which is the value you are looking for.

    Another way is to select Spy -> Windows and find you button in window hierarchy, then right select it and press properties, which will show you the same general tab as above.

    Third alternative is to select parent (ie. dialog window) for your button (ie. it will be of Dialog class), and register for WM_COMMAND messages from it. Then after pressing it you button ID will be displayed as wID: XX in message window.

    I have tested it on Calculator under win7 and win8, funny but spy++ from VS2005 didnt work for me on win7, while spy++ from VS2008 did work on win8. Also there is a 64 bit version of spy++.

    0 讨论(0)
提交回复
热议问题