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. C / C++ / MFC
  4. Automating another app

Automating another app

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpcomtutorialquestion
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.
  • T Offline
    T Offline
    Tom Archer
    wrote on last edited by
    #1

    In the name of code reuse, does anyone have pointers to articles that give examples of how to automate another app? Scenario: I'm writing an app that helps me do part of my job much faster. However, I must still manually copy and paste data from an existing .NET app into mine. Therefore, I'm looking for code examples of how to programmatically control the other app the way I would do so manually. Ex: 1) F4, enter data, press enter 2) Copy from fields 3) etc. Most of this I can guess, FindWindow (to locate app's main window), figure out how to send keystrokes, GetWindowText on specific windows, etc. I'm just hoping someone's already done something I can use real quick instead of blowing a few hours stumbling through it. Tom Archer (blog) Program Manager MSDN Online (Windows Vista and Visual C++) MICROSOFT -- modified at 23:47 Monday 27th March, 2006

    N 1 Reply Last reply
    0
    • T Tom Archer

      In the name of code reuse, does anyone have pointers to articles that give examples of how to automate another app? Scenario: I'm writing an app that helps me do part of my job much faster. However, I must still manually copy and paste data from an existing .NET app into mine. Therefore, I'm looking for code examples of how to programmatically control the other app the way I would do so manually. Ex: 1) F4, enter data, press enter 2) Copy from fields 3) etc. Most of this I can guess, FindWindow (to locate app's main window), figure out how to send keystrokes, GetWindowText on specific windows, etc. I'm just hoping someone's already done something I can use real quick instead of blowing a few hours stumbling through it. Tom Archer (blog) Program Manager MSDN Online (Windows Vista and Visual C++) MICROSOFT -- modified at 23:47 Monday 27th March, 2006

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      Tom Archer - MSFT wrote:

      Most of this I can guess, FindWindow (to locate app's main window), figure out how to send keystrokes, GetWindowText on specific windows, etc. I'm just hoping someone's already done something I can use real quick instead of blowing a few hours stumbling through it.

      Is this[^] what you want?


      Nibu thomas Software Developer

      T 1 Reply Last reply
      0
      • N Nibu babu thomas

        Tom Archer - MSFT wrote:

        Most of this I can guess, FindWindow (to locate app's main window), figure out how to send keystrokes, GetWindowText on specific windows, etc. I'm just hoping someone's already done something I can use real quick instead of blowing a few hours stumbling through it.

        Is this[^] what you want?


        Nibu thomas Software Developer

        T Offline
        T Offline
        Tom Archer
        wrote on last edited by
        #3

        Thanks Nibu. That gets me the SendKeys bit, but the hardest part is getting the data from other app. Generally, that's not too difficult with a standard Windows app. However, it's a .NET app so I'm not sure how to programmatically find the specific windows I need. Looking at Spy++, I can see several issues: 1) they all have the same class name, 2) what I would normally see as a listbox evidently is something else and so on. Therefore, what I'm looking for is an example of a C++ program driving a .NET application and basically screen scraping from the .NET apps windows. Tom Archer (blog) Program Manager MSDN Online (Windows Vista and Visual C++) MICROSOFT

        D 1 Reply Last reply
        0
        • T Tom Archer

          Thanks Nibu. That gets me the SendKeys bit, but the hardest part is getting the data from other app. Generally, that's not too difficult with a standard Windows app. However, it's a .NET app so I'm not sure how to programmatically find the specific windows I need. Looking at Spy++, I can see several issues: 1) they all have the same class name, 2) what I would normally see as a listbox evidently is something else and so on. Therefore, what I'm looking for is an example of a C++ program driving a .NET application and basically screen scraping from the .NET apps windows. Tom Archer (blog) Program Manager MSDN Online (Windows Vista and Visual C++) MICROSOFT

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Tom Archer - MSFT wrote:

          However, it's a .NET app so I'm not sure how to programmatically find the specific windows I need. Looking at Spy++, I can see several issues: 1) they all have the same class name, 2) what I would normally see as a listbox evidently is something else and so on.

          With a .NET Framework-based application, the window messages and classes intercepted by Spy++ don't correspond to anything useful. You want to see managed events and property values. See here for more.


          "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

          "There is no death, only a change of worlds." - Native American Proverb

          T 1 Reply Last reply
          0
          • D David Crow

            Tom Archer - MSFT wrote:

            However, it's a .NET app so I'm not sure how to programmatically find the specific windows I need. Looking at Spy++, I can see several issues: 1) they all have the same class name, 2) what I would normally see as a listbox evidently is something else and so on.

            With a .NET Framework-based application, the window messages and classes intercepted by Spy++ don't correspond to anything useful. You want to see managed events and property values. See here for more.


            "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

            "There is no death, only a change of worlds." - Native American Proverb

            T Offline
            T Offline
            Tom Archer
            wrote on last edited by
            #5

            Yep. I remembered this article last night. It's not 100% what I wanted in that it doesn't show how to find a particular window or what I'm capable of searching for, but it's definitely a start. Thanks David. Tom Archer (blog) Program Manager MSDN Online (Windows Vista and Visual C++) MICROSOFT

            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