Results 1 to 11 of 11

Thread: auto click on a button

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Lightbulb auto click on a button

    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

  2. #2
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    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


    VB Code:
    1. Call Command1_Click
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Re: auto click on a button

    i don't have the source code of that application.

  4. #4
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    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.
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  5. #5
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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 :-)
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    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.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  7. #7
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  8. #8
    Hyperactive Member
    Join Date
    Aug 2006
    Location
    TeXaS
    Posts
    497

    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.

  9. #9
    Hyperactive Member
    Join Date
    Aug 2006
    Location
    TeXaS
    Posts
    497

    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.

  10. #10
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Re: auto click on a button

    thanks.

    i will try it and get back to you soon.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width