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 Dialog member Variable problem

Accessing Dialog member Variable problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 5 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.
  • K Offline
    K Offline
    kamalilam
    wrote on last edited by
    #1

    Hi Friends, How can I Access CDialog Class Member Variables in CDocument Class For Some Process...i Tried a lot..but it give error..plz gve me a solution .. :)

    _ M C R 4 Replies Last reply
    0
    • K kamalilam

      Hi Friends, How can I Access CDialog Class Member Variables in CDocument Class For Some Process...i Tried a lot..but it give error..plz gve me a solution .. :)

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

      What is the relationship between the CDocument and CDialog classes in your project?

      «_Superman_» I love work. It gives me something to do between weekends.
      Microsoft MVP (Visual C++)

      1 Reply Last reply
      0
      • K kamalilam

        Hi Friends, How can I Access CDialog Class Member Variables in CDocument Class For Some Process...i Tried a lot..but it give error..plz gve me a solution .. :)

        M Offline
        M Offline
        Madhu Nair 0
        wrote on last edited by
        #3

        kamalilam wrote:

        Access CDialog Class Member Variables in CDocument Class

        If the member variables are declared as Public, use it directly from the object of the dialog class. For e.g ,

        CDocument* pDoc;
        pDoc->m_oDialog.m_nMember1 = 10;

        1 Reply Last reply
        0
        • K kamalilam

          Hi Friends, How can I Access CDialog Class Member Variables in CDocument Class For Some Process...i Tried a lot..but it give error..plz gve me a solution .. :)

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          The same way you would do for any other classes. Your CDialog and CDocument classes are still classes and they follow the same rules as normal classes. So, to be able to access a variable from a CDialog object, you first need to have an instance of that class (e.g. CDialog myDialog, in which case myDialog is your instance). Then your CDocument needs to be able to access that variable (if he create the instance, then he already owns it and can use it). Finally, the members you want to access in your dialog class have to be accessible, which means either they are public or you provide a getter method for them. But this is really basic C++ knowledge, I suggest you take some time to read and understand the concept of classes, because that's exactly what it is here. It's not because those classes are document and dialog classes that they do not follow the standard rules of C++.

          Cédric Moonen Software developer
          Charting control [v2.0] OpenGL game tutorial in C++

          1 Reply Last reply
          0
          • K kamalilam

            Hi Friends, How can I Access CDialog Class Member Variables in CDocument Class For Some Process...i Tried a lot..but it give error..plz gve me a solution .. :)

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #5

            Will you please include some relevant information in your post? Are the CDialog members you're talking about public? How is this CDialog object related to the CDocument object in your application?

            kamalilam wrote:

            Tried a lot..but it give error.

            *What* did you try and *what* were the errors for Chri' sake?

            “Follow your bliss.” – Joseph Campbell

            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