Results 1 to 3 of 3

Thread: [RESOLVED] External program access

  1. #1

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Resolved [RESOLVED] External program access

    Is it possible to simulate menu and button clicks or keypresses (eg. Ctrl+S) in an external program?

    I'm able to get the hwd of the external progam in question and have set foucs to it using the FindWindow and SetForegroundWindow API's but not sure where to start for the clicks/keypresses. Would appreciate any pointers

    EDIT: Have worked on this some more. I've used the GetMenu API to attempt to get the handle to the external app's menu but have run into a snag...the menus are all located on a toolbar so when I run the GetMenu API it always returns 0. I've read other posts with ppl using Spy++ to get Window handles and have used it to find the toolbar handle of the external app but now i'm stuck on getting the menu handle from the toolbar.

    Hope this makes sence
    Thanks.
    Last edited by lintz; Sep 12th, 2006 at 11:25 PM.

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

    Re: External program access

    there are many ways to send automated keystrokes, mouse clicks, and such to applications.
    most beginners use the vb command SendKeys() to send keystrokes. you should search for Sendkeys and find out how it works if you like.

    also for menu's, you can use api to find the Menu item Name, if you dont know the index and/or subindex of the menuitem, then you can click it via programming as well.

    i zipped up something i was working on a while back for menu api its not nearly finished but its pretty decent. for this sample, i added another module to it that simulates keypresses and mouseclicks as well. maybe you can use something from this.
    Attached Files Attached Files

  3. #3

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: External program access

    Thanks Billy, I've changed from API's to SendKeys which is working well as I've setup a bunch of Keyboard shortcuts in the external app and so far so good

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