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. Set Edit Box Text from Different Dialog

Set Edit Box Text from Different Dialog

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
9 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.
  • S Offline
    S Offline
    Sonani Prakash
    wrote on last edited by
    #1

    There are two seperate application dialog. on one dialog there is one text box as well as check box and on other dialog there is one button. now if I press on second dialog's button,then some text should be set on first dialog's text box and checkbox. I am able to set text of checkbox but not able to set text into edit box. I used logic like following CWnd* pWnd = CWnd::FindWindow(NULL,_T("TestDialog")); if (pWnd) { pWnd->ShowWindow(SW_SHOW); pWnd->SetForegroundWindow(); pWnd->SetDlgItemText(1003,"Hello"); pWnd->SetDlgItemText(1001,"Hello111"); } Can anybody tell me how to set text on other application dialog's edit box Thanks, Prakash

    sonani prakash

    H T 2 Replies Last reply
    0
    • S Sonani Prakash

      There are two seperate application dialog. on one dialog there is one text box as well as check box and on other dialog there is one button. now if I press on second dialog's button,then some text should be set on first dialog's text box and checkbox. I am able to set text of checkbox but not able to set text into edit box. I used logic like following CWnd* pWnd = CWnd::FindWindow(NULL,_T("TestDialog")); if (pWnd) { pWnd->ShowWindow(SW_SHOW); pWnd->SetForegroundWindow(); pWnd->SetDlgItemText(1003,"Hello"); pWnd->SetDlgItemText(1001,"Hello111"); } Can anybody tell me how to set text on other application dialog's edit box Thanks, Prakash

      sonani prakash

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      What happens if you use of GetDlgCtrlID() instead 1001


      WhiteSky


      S 1 Reply Last reply
      0
      • H Hamid Taebi

        What happens if you use of GetDlgCtrlID() instead 1001


        WhiteSky


        S Offline
        S Offline
        Sonani Prakash
        wrote on last edited by
        #3

        Now I am able to set text using SendMessage(WM_SETTEXT,...) Now I have question about getting ID or handle of the edit box of other application dialog ?

        sonani prakash

        H 1 Reply Last reply
        0
        • S Sonani Prakash

          Now I am able to set text using SendMessage(WM_SETTEXT,...) Now I have question about getting ID or handle of the edit box of other application dialog ?

          sonani prakash

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          You can use of this code if we suppose you have two dialogs Main and Local then insert this code on the Local

          CMain *m_pMain=(CMain*)GetParent();

          m_pMain->function or variables on other dialog


          WhiteSky


          S 1 Reply Last reply
          0
          • H Hamid Taebi

            You can use of this code if we suppose you have two dialogs Main and Local then insert this code on the Local

            CMain *m_pMain=(CMain*)GetParent();

            m_pMain->function or variables on other dialog


            WhiteSky


            S Offline
            S Offline
            Sonani Prakash
            wrote on last edited by
            #5

            BOTH THE DIALOGS ARE PART OF SEPERATE APPLIATIONS. SO First I can get the handle of dialog windows of other application but problem about it's edit box.

            sonani prakash

            H 1 Reply Last reply
            0
            • S Sonani Prakash

              BOTH THE DIALOGS ARE PART OF SEPERATE APPLIATIONS. SO First I can get the handle of dialog windows of other application but problem about it's edit box.

              sonani prakash

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              You can use of EnumChildWindow for enumerates child windows and the use of GetClassName and check if returned class is EDIT also see here[^]


              WhiteSky


              S 1 Reply Last reply
              0
              • H Hamid Taebi

                You can use of EnumChildWindow for enumerates child windows and the use of GetClassName and check if returned class is EDIT also see here[^]


                WhiteSky


                S Offline
                S Offline
                Sonani Prakash
                wrote on last edited by
                #7

                I have used the same and got the solution. Thanks for your help. Prakash.

                sonani prakash

                H 1 Reply Last reply
                0
                • S Sonani Prakash

                  I have used the same and got the solution. Thanks for your help. Prakash.

                  sonani prakash

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #8

                  You're welcome ;)


                  WhiteSky


                  1 Reply Last reply
                  0
                  • S Sonani Prakash

                    There are two seperate application dialog. on one dialog there is one text box as well as check box and on other dialog there is one button. now if I press on second dialog's button,then some text should be set on first dialog's text box and checkbox. I am able to set text of checkbox but not able to set text into edit box. I used logic like following CWnd* pWnd = CWnd::FindWindow(NULL,_T("TestDialog")); if (pWnd) { pWnd->ShowWindow(SW_SHOW); pWnd->SetForegroundWindow(); pWnd->SetDlgItemText(1003,"Hello"); pWnd->SetDlgItemText(1001,"Hello111"); } Can anybody tell me how to set text on other application dialog's edit box Thanks, Prakash

                    sonani prakash

                    T Offline
                    T Offline
                    ThatsAlok
                    wrote on last edited by
                    #9

                    better use SetDlgItemText from other window!

                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                    cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

                    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