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. vc++ 6 mfc, easiest way to pass variables between dlgs?

vc++ 6 mfc, easiest way to pass variables between dlgs?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
12 Posts 5 Posters 3 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.
  • R Offline
    R Offline
    rolfhorror
    wrote on last edited by
    #1

    i have two dlgs which i want to access the same variable, i,ve got some global variables in the "Globals" folder but i cant access them from the childdlg. i thought global was GLOBAL? how to do this easy. thx

    V L T T 4 Replies Last reply
    0
    • R rolfhorror

      i have two dlgs which i want to access the same variable, i,ve got some global variables in the "Globals" folder but i cant access them from the childdlg. i thought global was GLOBAL? how to do this easy. thx

      V Offline
      V Offline
      vikas amin
      wrote on last edited by
      #2

      If the variable is in the parent window which create the dialog you can use GetParent() method to get the parent window , and make sure your global variable is declared in parent header with public access.

      Vikas Amin

      My First Article on CP" Virtual Serial Port "[^]

      modified on Thursday, July 24, 2008 5:33 PM

      R 1 Reply Last reply
      0
      • R rolfhorror

        i have two dlgs which i want to access the same variable, i,ve got some global variables in the "Globals" folder but i cant access them from the childdlg. i thought global was GLOBAL? how to do this easy. thx

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #3

        rolfhorror wrote:

        i,ve got some global variables in the "Global" folder

        Really? I'm not the most experienced developer around but I'm pretty sure you can't put variables into folders. :rolleyes:

        rolfhorror wrote:

        how to do this easy.

        If you don't understand that those Dialogs are Classes and/or if you don't understand how to pass/access variables between classes then my guess would be that this might be the easiest.[^]

        led mike

        R 1 Reply Last reply
        0
        • L led mike

          rolfhorror wrote:

          i,ve got some global variables in the "Global" folder

          Really? I'm not the most experienced developer around but I'm pretty sure you can't put variables into folders. :rolleyes:

          rolfhorror wrote:

          how to do this easy.

          If you don't understand that those Dialogs are Classes and/or if you don't understand how to pass/access variables between classes then my guess would be that this might be the easiest.[^]

          led mike

          R Offline
          R Offline
          rolfhorror
          wrote on last edited by
          #4

          when i say folder, i mean the "folder" at the bottom on the classtree with the name "Globals".

          L 1 Reply Last reply
          0
          • V vikas amin

            If the variable is in the parent window which create the dialog you can use GetParent() method to get the parent window , and make sure your global variable is declared in parent header with public access.

            Vikas Amin

            My First Article on CP" Virtual Serial Port "[^]

            modified on Thursday, July 24, 2008 5:33 PM

            R Offline
            R Offline
            rolfhorror
            wrote on last edited by
            #5

            thanx i'll look into that

            1 Reply Last reply
            0
            • R rolfhorror

              when i say folder, i mean the "folder" at the bottom on the classtree with the name "Globals".

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #6

              rolfhorror wrote:

              maybe you should look at that book yourself

              Good one! You are well on your way to being an excellent C++ developer! Good luck.

              led mike

              R 1 Reply Last reply
              0
              • L led mike

                rolfhorror wrote:

                maybe you should look at that book yourself

                Good one! You are well on your way to being an excellent C++ developer! Good luck.

                led mike

                R Offline
                R Offline
                rolfhorror
                wrote on last edited by
                #7

                i'm not here to flame, so no offense. it was all in good humor. :-) (by the way, i have that book)

                L 1 Reply Last reply
                0
                • R rolfhorror

                  i'm not here to flame, so no offense. it was all in good humor. :-) (by the way, i have that book)

                  L Offline
                  L Offline
                  led mike
                  wrote on last edited by
                  #8

                  rolfhorror wrote:

                  i'm not here to flame, so no offense. it was all in good humor.

                  :cool:

                  rolfhorror wrote:

                  (by the way, i have that book)

                  Then my comment about the dialogs being classes and that standard mechanisms for passing values or accessing values applies, should have helped yes? I mean I have not read that book but I would imagine that is covered yes?

                  led mike

                  R 1 Reply Last reply
                  0
                  • L led mike

                    rolfhorror wrote:

                    i'm not here to flame, so no offense. it was all in good humor.

                    :cool:

                    rolfhorror wrote:

                    (by the way, i have that book)

                    Then my comment about the dialogs being classes and that standard mechanisms for passing values or accessing values applies, should have helped yes? I mean I have not read that book but I would imagine that is covered yes?

                    led mike

                    R Offline
                    R Offline
                    rolfhorror
                    wrote on last edited by
                    #9

                    thanx for you help :-)

                    1 Reply Last reply
                    0
                    • R rolfhorror

                      i have two dlgs which i want to access the same variable, i,ve got some global variables in the "Globals" folder but i cant access them from the childdlg. i thought global was GLOBAL? how to do this easy. thx

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

                      just a guess, have you checked this[^] article ?

                      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                      R 1 Reply Last reply
                      0
                      • T toxcct

                        just a guess, have you checked this[^] article ?

                        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                        R Offline
                        R Offline
                        rolfhorror
                        wrote on last edited by
                        #11

                        thanx, this is what i was looking for :-)

                        1 Reply Last reply
                        0
                        • R rolfhorror

                          i have two dlgs which i want to access the same variable, i,ve got some global variables in the "Globals" folder but i cant access them from the childdlg. i thought global was GLOBAL? how to do this easy. thx

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

                          it it is integer, than you can use PostMessage to tranfer values in active mode. since other wise just update the shared values for passive mode transfer.

                          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                          Never mind - my own stupidity is the source of every "problem" - Mixture

                          cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/xml>

                          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