Re: auto click on a button
Quote:
Originally Posted by shahid
hello,
an application is running already in a P.C i don't have the source code
it's only an exe file build in visual basic 6.
where i need to press a button every time to run the process get the data from device and put it text file.
is there any way that it will click auto... or it's run automaticly whenever i open the form.
thru API or any other way
thanks
How about
Re: auto click on a button
i don't have the source code of that application.
Re: auto click on a button
if you don't have the source code, than about all you can do is create a macro, in which you press the command button, and run the app using it.
Re: auto click on a button
Quote:
Originally Posted by Pasvorto
if you don't have the source code, than about all you can do is create a macro, in which you press the command button, and run the app using it.
Not quite true...you can do stuff with HWND and such to grab the handle of the app and control aspects within it(or something like that...point is it's doable and not that difficult)...I dunno how, but I am sure others here will be able to do it :-)
Re: auto click on a button
You have to write a program to do that, smUX. I think shahid wants to be able to do it with the original program, but without having the source code for the program - and that's not possible.
Re: auto click on a button
He says "thru API or any other way" at the end of the first post, suggesting a second program is okay :-P
Re: auto click on a button
first i suggest you get an API-spy app. availiable everywhere online. the purpose of this would be to find Child-Parent relationship of the object you want to manipulate. ones with sorted lists dont really work for what you want.
if you want to do this on your own, you just need to use the api-spy app to retrieve the handle of the window, and work from there. otherwise if you want the app to progmatically find and manipulate that window there is more involved..
Basics of how it works...
Windows lets us use a 'Getwindow' api, it has a few constants you can use to control the direction of the search and such.
Windows has setup a 'window order' if you will. consisting of parents and children of those parents. such as form --> frame ---> buttons. you can move the children around as you wish to another parent and create a child window in the base(root) of the structure as well using various api calls. so usually its not that well organized when you look at it unsorted.
the basic idea is that you will have to follow the child-parent relationships down the ladder in order to properly find the object you wish to use. you'll have to atleast store the Classname of the objects (and you may record the caption if you think its unique), and for multiple buttons or listboxes. they will always have the same order, so you can identify them that way.
then you will use Api's 'FindWindowEx' and 'FindWindow' to do the final search for them when you want to find the handles.
the code really isnt hard to do. but the order of the calls must be precise to the structure, otherwise your window will not be found in the searching.
once we have all the info of this from you, we could code this without you having to learn everything. but then again, i'd love for you to learn how to do this yourself.
Re: auto click on a button
now that i think about it. i wonder if anyone has written an app that lets you input a handle, and its output would be source code to find that window? that would be fun to work on if i had more time.
Re: auto click on a button
Quote:
Originally Posted by Billy Conner
that would be fun to work on if i had more time.
Programming for Masochists - Part 1 :-P
Re: auto click on a button
thanks.
i will try it and get back to you soon.