Jump to content

.NET: ControlClick only works with ControlGetHandle before it


Recommended Posts

I've run into something peculiar, which I haven't been able to find more info on with the search.

The issue is a dropdownbox-control which I want to click, in a .NET program. The Class changes for everytime it is run.
When I do a normal ControlClick, nothing happens and it exits with 0.

I tried ControlClick referencing the control with [NAME:] and/or with [TEXT:] but that does not work.
However, if right before the ControlClick, I do a ControlGetHandle statement, then the ControlClick will suddenly work after all...

The window title stays the same, and there is only 1 control with that text.

Example:
ControlClick("Navigator","","[TEXT:Raster]") does not work. Returns with 0.
----
ControlGetHandle("Navigator","","[TEXT:Raster]") Returns with 1.
ControlClick("Navigator","","[TEXT:R
aster]") works and returns with 1.


Why is this happening?
I'm glad it works, but I get the feeling I'm doing something in a wrong way.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...