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 do get a child dialogs handle?

How do get a child dialogs handle?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I would like to use the CMyTabCtrl class for Tabs. I put a tab control on my dialog and implemented the code. The problem is that the buttons I have put on the tab have local message maps. I would like for them to call functions on my main dialog. I can not get the handle so that I can call class functions there. Help?:confused: :confused:

    P 1 Reply Last reply
    0
    • L Lost User

      I would like to use the CMyTabCtrl class for Tabs. I put a tab control on my dialog and implemented the code. The problem is that the buttons I have put on the tab have local message maps. I would like for them to call functions on my main dialog. I can not get the handle so that I can call class functions there. Help?:confused: :confused:

      P Offline
      P Offline
      Paolo Messina
      wrote on last edited by
      #2

      Sample function:

      CMyTabCtrl::MyFunction()
      {
      CMyDialog *pDlg = (CMyDialog*)GetParent();

      pDlg->TheOtherFunction();
      
      ...
      

      }

      Do that only if the dialog is the parent window and it is of class CMyDialog. Cheers, Paolo ------ "airplane is cool, but space shuttle is even better" (J. Kaczorowski)

      M 1 Reply Last reply
      0
      • P Paolo Messina

        Sample function:

        CMyTabCtrl::MyFunction()
        {
        CMyDialog *pDlg = (CMyDialog*)GetParent();

        pDlg->TheOtherFunction();
        
        ...
        

        }

        Do that only if the dialog is the parent window and it is of class CMyDialog. Cheers, Paolo ------ "airplane is cool, but space shuttle is even better" (J. Kaczorowski)

        M Offline
        M Offline
        Michael Flood
        wrote on last edited by
        #3

        Duh! This is what I get for not doing any windows programming for about a year. will not let that happen again. I think my problem was that I was casting as a CDialog instead of the derived class that includes all of my functions. Thanks Paolo. Sometimes to catch mice, you have to act like cheese...:laugh:

        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