Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Need advice on best ways to launch and control another application.

Need advice on best ways to launch and control another application.

Scheduled Pinned Locked Moved Visual Basic
questionjsontutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Meanderthal
    wrote on last edited by
    #1

    I am writing a program that needs to launch another program, log in, run another program, and then type in some text or make selections in a list box. I've figured out how to launch the app and get's it's window handle but that's it. I'm at a loss as to how to find the resulting window and send clicks, keystrokes, or whatever. Worse, after intially launching the first app (Citrix, if your are curious), I will be presented with a login screen, a folder with several icons one of which will need to be launched, another login screen, another virtual folder with an app that needs to be run, etc. So what is the best way to approach this? I've been reading up on the Windows API... This is frustrating because at home I often use a program called Macro Express to automate this sort of thing.

    S K 2 Replies Last reply
    0
    • M Meanderthal

      I am writing a program that needs to launch another program, log in, run another program, and then type in some text or make selections in a list box. I've figured out how to launch the app and get's it's window handle but that's it. I'm at a loss as to how to find the resulting window and send clicks, keystrokes, or whatever. Worse, after intially launching the first app (Citrix, if your are curious), I will be presented with a login screen, a folder with several icons one of which will need to be launched, another login screen, another virtual folder with an app that needs to be run, etc. So what is the best way to approach this? I've been reading up on the Windows API... This is frustrating because at home I often use a program called Macro Express to automate this sort of thing.

      S Offline
      S Offline
      StylezHouse
      wrote on last edited by
      #2

      It's been a while, but I think you want to look at the sendmessagee function in the win32 api.

      1 Reply Last reply
      0
      • M Meanderthal

        I am writing a program that needs to launch another program, log in, run another program, and then type in some text or make selections in a list box. I've figured out how to launch the app and get's it's window handle but that's it. I'm at a loss as to how to find the resulting window and send clicks, keystrokes, or whatever. Worse, after intially launching the first app (Citrix, if your are curious), I will be presented with a login screen, a folder with several icons one of which will need to be launched, another login screen, another virtual folder with an app that needs to be run, etc. So what is the best way to approach this? I've been reading up on the Windows API... This is frustrating because at home I often use a program called Macro Express to automate this sort of thing.

        K Offline
        K Offline
        Kunal Shetye
        wrote on last edited by
        #3

        Well you could use EnumWindows to get the list of all top level windows. Then you could use EnumChildWindows to get the list of the child compoments inside the parent. Since you are posting this in VB section i am asuming that you are using VB, then you can use AppActivate to set focus on the window and then SendKeys to send the keys to the window :-D To run an application you can use the Shell function which returns the process id if the program is running. ------------------------------------------- Taken From MSDN 2003 ------------------------------------------- 'Example AppActivate("Untitled - Notepad") SendKeys.SendWait("Hello world!") ' Send Ctrl S to open the Save As dialog box. SendKeys.SendWait("^S") ' Send the name of the new file. SendKeys.SendWait("c:\HelloWorld.txt") ' Send Alt S to save the file. SendKeys.SendWait("%S") ------------------------------------------- I hope the above helps :) Life Is A Cipher Substituting "happiness" with "sadness" and Transforming "pleasure" into "pain"

        S M 2 Replies Last reply
        0
        • K Kunal Shetye

          Well you could use EnumWindows to get the list of all top level windows. Then you could use EnumChildWindows to get the list of the child compoments inside the parent. Since you are posting this in VB section i am asuming that you are using VB, then you can use AppActivate to set focus on the window and then SendKeys to send the keys to the window :-D To run an application you can use the Shell function which returns the process id if the program is running. ------------------------------------------- Taken From MSDN 2003 ------------------------------------------- 'Example AppActivate("Untitled - Notepad") SendKeys.SendWait("Hello world!") ' Send Ctrl S to open the Save As dialog box. SendKeys.SendWait("^S") ' Send the name of the new file. SendKeys.SendWait("c:\HelloWorld.txt") ' Send Alt S to save the file. SendKeys.SendWait("%S") ------------------------------------------- I hope the above helps :) Life Is A Cipher Substituting "happiness" with "sadness" and Transforming "pleasure" into "pain"

          S Offline
          S Offline
          StylezHouse
          wrote on last edited by
          #4

          SendKeys!! Thats what I was thinking of...

          1 Reply Last reply
          0
          • K Kunal Shetye

            Well you could use EnumWindows to get the list of all top level windows. Then you could use EnumChildWindows to get the list of the child compoments inside the parent. Since you are posting this in VB section i am asuming that you are using VB, then you can use AppActivate to set focus on the window and then SendKeys to send the keys to the window :-D To run an application you can use the Shell function which returns the process id if the program is running. ------------------------------------------- Taken From MSDN 2003 ------------------------------------------- 'Example AppActivate("Untitled - Notepad") SendKeys.SendWait("Hello world!") ' Send Ctrl S to open the Save As dialog box. SendKeys.SendWait("^S") ' Send the name of the new file. SendKeys.SendWait("c:\HelloWorld.txt") ' Send Alt S to save the file. SendKeys.SendWait("%S") ------------------------------------------- I hope the above helps :) Life Is A Cipher Substituting "happiness" with "sadness" and Transforming "pleasure" into "pain"

            M Offline
            M Offline
            Meanderthal
            wrote on last edited by
            #5

            Yes that does help, thanks. I guess I just need to take them on one by one and see what works by trial and error.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups