Pergunta

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 to click, so I am using it right now. I have found the window which contains the button I wish to get the button ID from (there are 3 buttons in the window).

Where in spy++ can I find the specific buttons ID? I looked in the "window properties" of the window that contains the buttons and didn't find it. There are 3 buttons there so I am guessing I will find 3 button ID's somewhere but I haven't yet.

Foi útil?

Solução

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++.

Outras dicas

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).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top