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. How to get control of another code's dialog box

How to get control of another code's dialog box

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
3 Posts 2 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.
  • L Offline
    L Offline
    largenqcd
    wrote on last edited by
    #1

    I'm not sure this is possible - is there a way that I can do the following - I'd like to modify the text in the the filename Edit box of a File Save dialog in a 3rd party program (for which I don't have the source code). Could I do this by using Spy++ to get the handle to the dialog and the Edit box, then use my code to modify the text? Thanks! Tom

    L 1 Reply Last reply
    0
    • L largenqcd

      I'm not sure this is possible - is there a way that I can do the following - I'd like to modify the text in the the filename Edit box of a File Save dialog in a 3rd party program (for which I don't have the source code). Could I do this by using Spy++ to get the handle to the dialog and the Edit box, then use my code to modify the text? Thanks! Tom

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Yes, I think it is called automation. It takes figuring the dialog's handle, the textbox's handle (or its tab position), then sending some characters using SendKeys. I tend to identify the foreground window (using user32's GetForegroundWindow) to improve the reliability. Warning: whatever you do it won't be fool proof (unless you can use an API the app provides). There always is a possibility something unexpected happens, e.g. another dialog pops up informing the user about an exceptional situation; and the interactive user might be interfering too. [ADDED] Automation may also stop working when the system load changes dramatically (so operations suddenly exceed the timeouts you have installed), when the app's settings (or the system's regional settings) get changed, when a new version of the app gets installed. [/ADDED] :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

      modified on Tuesday, September 28, 2010 10:51 PM

      L 1 Reply Last reply
      0
      • L Luc Pattyn

        Yes, I think it is called automation. It takes figuring the dialog's handle, the textbox's handle (or its tab position), then sending some characters using SendKeys. I tend to identify the foreground window (using user32's GetForegroundWindow) to improve the reliability. Warning: whatever you do it won't be fool proof (unless you can use an API the app provides). There always is a possibility something unexpected happens, e.g. another dialog pops up informing the user about an exceptional situation; and the interactive user might be interfering too. [ADDED] Automation may also stop working when the system load changes dramatically (so operations suddenly exceed the timeouts you have installed), when the app's settings (or the system's regional settings) get changed, when a new version of the app gets installed. [/ADDED] :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

        modified on Tuesday, September 28, 2010 10:51 PM

        L Offline
        L Offline
        largenqcd
        wrote on last edited by
        #3

        Thanks, I'll give it a try! It's just a "hobby" application that I want to write, not critical if it fails sometimes... Thanks, Tom

        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