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. Communicating with top level form from child forms

Communicating with top level form from child forms

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
4 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.
  • M Offline
    M Offline
    mrhonus
    wrote on last edited by
    #1

    Using the designer to create the main form for an application generated the following code in the .cpp file: int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA; Application::Run(new DataForm(lpCmdLine)); return 0; } The DataForm class has a button which generates a new form: linkedForm = new LinkedForm() ; The LinkedForm class exists in the same namespace as the DataForm class. What needs to be done to allow this child form to see public methods in it's parent, since a DataForm ptr cannot be declared globally? Are there any examples of parent/child form communications of this nature? Thanks, MrHonus

    W H 2 Replies Last reply
    0
    • M mrhonus

      Using the designer to create the main form for an application generated the following code in the .cpp file: int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA; Application::Run(new DataForm(lpCmdLine)); return 0; } The DataForm class has a button which generates a new form: linkedForm = new LinkedForm() ; The LinkedForm class exists in the same namespace as the DataForm class. What needs to be done to allow this child form to see public methods in it's parent, since a DataForm ptr cannot be declared globally? Are there any examples of parent/child form communications of this nature? Thanks, MrHonus

      W Offline
      W Offline
      William Wang
      wrote on last edited by
      #2

      seems this is not a standard MFC program, u might post it to Manage C++/CLI forum. life is like a box of chocolate,you never know what you r going to get.

      1 Reply Last reply
      0
      • M mrhonus

        Using the designer to create the main form for an application generated the following code in the .cpp file: int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA; Application::Run(new DataForm(lpCmdLine)); return 0; } The DataForm class has a button which generates a new form: linkedForm = new LinkedForm() ; The LinkedForm class exists in the same namespace as the DataForm class. What needs to be done to allow this child form to see public methods in it's parent, since a DataForm ptr cannot be declared globally? Are there any examples of parent/child form communications of this nature? Thanks, MrHonus

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

        Is it CLI/C++_**


        **_

        whitesky


        M 1 Reply Last reply
        0
        • H Hamid Taebi

          Is it CLI/C++_**


          **_

          whitesky


          M Offline
          M Offline
          mrhonus
          wrote on last edited by
          #4

          Is it CI/C++? It was created using Visual Studio and .NET, so I guess the answer is yes.

          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