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. Interacting with a 3rd party application dialog window

Interacting with a 3rd party application dialog window

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
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.
  • S Offline
    S Offline
    Still learning how to code
    wrote on last edited by
    #1

    Hello, I am trying to interact dynamically with a 3rd party application dialog. This dialog has the usual OK and CANCEL buttons and an edit box. I want to be able to set the text in this edit box. I have managed to enumerate the handle of the dialog, but can't see how to find the ID of the edit box in order to get it's handle and thereby set the text. Perhaps someone can point me in the right direction !! Doug

    P 1 Reply Last reply
    0
    • S Still learning how to code

      Hello, I am trying to interact dynamically with a 3rd party application dialog. This dialog has the usual OK and CANCEL buttons and an edit box. I want to be able to set the text in this edit box. I have managed to enumerate the handle of the dialog, but can't see how to find the ID of the edit box in order to get it's handle and thereby set the text. Perhaps someone can point me in the right direction !! Doug

      P Offline
      P Offline
      Paul M Watt
      wrote on last edited by
      #2

      You can use the call GetWindow, and use the GW_CHILD flag to start out with. Then test for the type of class of that window with a call to GetClassName. You are looking for the "EDIT" class. When you find a window whose class matches that criteria, you will have the handle to the Edit control. After testing each handle, if you have not found the correct window, then call for the next child window of the dialog, using the child window handle from the previous call to GetWindow, and this time use the GW_HWNDNEXT flag. Ex. HINSTANCE hInst; HWND hDlg; TCHAR className[_MAX_PATH]; ... HWND hChildWnd = ::GetWindow(hDlg, GW_CHILD); while (hChildWnd != NULL) { WNDCLASS wndClass; ::GetClassInfo(hChildWnd, className, sizeof(className)); if (0 == ::_tcscmp(className, _T("EDIT")) { // This is the window handle that you want. // Record the window handle here or do your special processing. ... break; } hChildWnd = ::GetWindow(hChildWnd, GW_HWNDNEXT); } If there are more than one edit controls on the dialog things get a bit trickier. You should look at the tool Spy++ that came with Visual Studio, it will allow you to peek at all of the important data regarding the windows, its class type, id etc.

      S 1 Reply Last reply
      0
      • P Paul M Watt

        You can use the call GetWindow, and use the GW_CHILD flag to start out with. Then test for the type of class of that window with a call to GetClassName. You are looking for the "EDIT" class. When you find a window whose class matches that criteria, you will have the handle to the Edit control. After testing each handle, if you have not found the correct window, then call for the next child window of the dialog, using the child window handle from the previous call to GetWindow, and this time use the GW_HWNDNEXT flag. Ex. HINSTANCE hInst; HWND hDlg; TCHAR className[_MAX_PATH]; ... HWND hChildWnd = ::GetWindow(hDlg, GW_CHILD); while (hChildWnd != NULL) { WNDCLASS wndClass; ::GetClassInfo(hChildWnd, className, sizeof(className)); if (0 == ::_tcscmp(className, _T("EDIT")) { // This is the window handle that you want. // Record the window handle here or do your special processing. ... break; } hChildWnd = ::GetWindow(hChildWnd, GW_HWNDNEXT); } If there are more than one edit controls on the dialog things get a bit trickier. You should look at the tool Spy++ that came with Visual Studio, it will allow you to peek at all of the important data regarding the windows, its class type, id etc.

        S Offline
        S Offline
        Still learning how to code
        wrote on last edited by
        #3

        Hi Paul, What a brilliantly comprehensive answer ! Very many thanks ! :-D :-D :-D :thumbsup: Doug

        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