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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. get name (or class) of parent dialog

get name (or class) of parent dialog

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 4 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
    tiziacaia
    wrote on last edited by
    #1

    I have two dialog: one parent and one child. Can I get the name (or the class) of the parent from the child? thanks a lot

    T T T 3 Replies Last reply
    0
    • T tiziacaia

      I have two dialog: one parent and one child. Can I get the name (or the class) of the parent from the child? thanks a lot

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

      Really I don't Understand what do you want. if You need to access the class member of parent from child. here is solution In Child Dlg Class ,declare a var which is pointer to Parent Class. like this CParentDlg *m_ParentDlg; and Function GetParentWnd(CParentDlg *m_Wnd) { m_ParentDlg=m_Wnd; } now in Parent Class before calling the Child DLg pass parent pointer mChildDlg.GetParentWnd(this); ///call the domodal or showindow and use m_ParentDlg in your Child class to access info from main parent Dlg ----------------------------- "I Think this Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk

      T 1 Reply Last reply
      0
      • T ThatsAlok

        Really I don't Understand what do you want. if You need to access the class member of parent from child. here is solution In Child Dlg Class ,declare a var which is pointer to Parent Class. like this CParentDlg *m_ParentDlg; and Function GetParentWnd(CParentDlg *m_Wnd) { m_ParentDlg=m_Wnd; } now in Parent Class before calling the Child DLg pass parent pointer mChildDlg.GetParentWnd(this); ///call the domodal or showindow and use m_ParentDlg in your Child class to access info from main parent Dlg ----------------------------- "I Think this Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk

        T Offline
        T Offline
        tiziacaia
        wrote on last edited by
        #3

        Thanks a lot for your answer but i can't use this solution. I try to explain me better (i don't speak english very well). I call the same child dialog from two different parent and i need to know wich is the parent in both the cases. Do you understand what i want? Thanks a lot on more time!

        B 1 Reply Last reply
        0
        • T tiziacaia

          Thanks a lot for your answer but i can't use this solution. I try to explain me better (i don't speak english very well). I call the same child dialog from two different parent and i need to know wich is the parent in both the cases. Do you understand what i want? Thanks a lot on more time!

          B Offline
          B Offline
          Blake Miller
          wrote on last edited by
          #4

          Well, you could always send a registered message to your parent window and it can respond with a different return value depending upon which one it is. Or, you can set a global variable containing the parent window's 'type when the parent is created and then the child can read it. Or you can use GetParent and then call RealGetWindowClass. There are other ways, but these came to mind pretty quickly.

          1 Reply Last reply
          0
          • T tiziacaia

            I have two dialog: one parent and one child. Can I get the name (or the class) of the parent from the child? thanks a lot

            T Offline
            T Offline
            toxcct
            wrote on last edited by
            #5

            CString str;
            GetParent()->GetWindowText(str);
            // The name of the parent's dialog is in the str string.


            TOXCCT >>> GEII power
            [VisualCalc] | [toxcct]

            1 Reply Last reply
            0
            • T tiziacaia

              I have two dialog: one parent and one child. Can I get the name (or the class) of the parent from the child? thanks a lot

              T Offline
              T Offline
              tiziacaia
              wrote on last edited by
              #6

              thanks a lot everybody!

              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