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. Accessing parent dialog?

Accessing parent dialog?

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

    Hello, I have a single dialog with a custom control which is based on the CWnd class. From method in the custom control, I need to access a variable from the dialog's class. How would I need to make this call to say a getValue() method? FYI, I am using VC6.

    _ S V 3 Replies Last reply
    0
    • C ctroyp

      Hello, I have a single dialog with a custom control which is based on the CWnd class. From method in the custom control, I need to access a variable from the dialog's class. How would I need to make this call to say a getValue() method? FYI, I am using VC6.

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      ctroyp wrote:

      Accessing parent dialog

      Use GetParent(). This will provide you with a pointer with which you can call getValue().

      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

      1 Reply Last reply
      0
      • C ctroyp

        Hello, I have a single dialog with a custom control which is based on the CWnd class. From method in the custom control, I need to access a variable from the dialog's class. How would I need to make this call to say a getValue() method? FYI, I am using VC6.

        S Offline
        S Offline
        Sarath C
        wrote on last edited by
        #3

        Im not sure, whether the GetParent call from a COM control will work out. Anyway, call GetParent(), if you get a valid parent handler, type cast it to your Dialog class' pointer. using dynamic_cast will be safe for this. then you can call the public interfaces. You may have to use the header file and other stuffs of dialog class in the control class.

        SaRath.
        _"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"


        My Blog | Understanding State Pattern_

        1 Reply Last reply
        0
        • C ctroyp

          Hello, I have a single dialog with a custom control which is based on the CWnd class. From method in the custom control, I need to access a variable from the dialog's class. How would I need to make this call to say a getValue() method? FYI, I am using VC6.

          V Offline
          V Offline
          Vipin Aravind
          wrote on last edited by
          #4

          you should not directly access the members of the dialog using the pointer, in which case your custom control no more is a reuseable custom control. You should define user defined message handlers in target window and then try to set/get anything using it. Vipin http://www.explorewindows.com/Blogs

          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