PDA

View Full Version : VBA code to automatically click an element of a toolstrip



erke
08-30-2016, 01:04 AM
Im triying to automate the control of a program. I want to load a big amount of files automatically.
The program loke like this (winspector view and and corresponding api view):

16972
As you can see, I have 7 element in my toolstrip. What I want to do is to figure out some way to click the desire element of this toolstrip (lets call the "n" element)
By doing this:

'lhWndP is the parent window handle
toolstriphandl= FindWindowEx(lhWndP, 0&, "WindowsForms10.Window.8.app.0.378734a", "toolStrip1")I get the handle of the toolstrip, but I dont know what to do now.
I tried to do this:

toolstripmenu = GetMenu(toolstriphandl)
toolstripmenu = GetSubMenu(toolstripmenu, n)
SendMessage toolstriphandl, WM_COMMAND, toolstripmenu, 0But doesn't seems to work.
Any idea please? Im desperate with this.
Thank you.