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 fill out fields in a third party program's GUI window

how to fill out fields in a third party program's GUI window

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
2 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.
  • T Offline
    T Offline
    Tanveer Ansari 1
    wrote on last edited by
    #1

    I have a program that finds trading opportunities. I want to be able to provide the ability to auto fill the order information in third party trade order-entry programs. What is a good place to start to build this? This is on Windows XP. So far I have looked at GetWindowLongPtr and SetWindowLongPtr. If anybody has any sample code that would be awesome.

    L 1 Reply Last reply
    0
    • T Tanveer Ansari 1

      I have a program that finds trading opportunities. I want to be able to provide the ability to auto fill the order information in third party trade order-entry programs. What is a good place to start to build this? This is on Windows XP. So far I have looked at GetWindowLongPtr and SetWindowLongPtr. If anybody has any sample code that would be awesome.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What is the program you are dealing with? Does it have a window with text fields you want to fill in? If so you do this: Open the program and reach the top window you want to deal with. The top window is a window with text fields. Using Spy++ from Visual Studio tools you read the ID for each text field (or other control) that you want to fill in and check what its relation to the top window is Once you have relation and ID you are very close. Now in order to get the top window you need its name and/or its relation with the main application window. And then using FindWindow EnumWindows EnumChildWindows... you can reach the top window of each control. Now you need GetDlgItem to get actual control that you want to fill in. Once you have HWND for each control SetWindowText() is sufficient for most text control, however for radio button etc. you need to use other functions to set the value or state. If you are sure that HWND you've got is from the control you need you can always use CWnd::FromHandle and even better upgrade such CWnd* to CEdit* or whatever control you have. However once the program is changed and any control ID, or their position is changed, you have to fix your code as well. The above procedure is used for automated testing a dialog and filling it from another application, so I know :) it must work. Without Spy++ or a similar application all this would be almost impossible to complete.

      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