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 to set Member variable as extern variable [modified]

How to set Member variable as extern variable [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
19 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.
  • L Lost User

    I'am so sorry .I've made a serious mistake.

    class CPipeLineApp : public CWinApp
    {
    public:
    CDengLu* dgDlg;
    .....
    };

    I want to call dgDlg in class CMainFrame. I also want to call dgDlg's variables: name and pass Forwarding your help.

    A Offline
    A Offline
    Albert Holguin
    wrote on last edited by
    #8

    still not sure what the problem is... if CPipeLineApp is derived from CWinApp, then he owns the CMainFrame, so you have complete access to it...

    1 Reply Last reply
    0
    • L Lost User

      I'am so sorry .I've made a serious mistake.

      class CPipeLineApp : public CWinApp
      {
      public:
      CDengLu* dgDlg;
      .....
      };

      I want to call dgDlg in class CMainFrame. I also want to call dgDlg's variables: name and pass Forwarding your help.

      A Offline
      A Offline
      Albert Holguin
      wrote on last edited by
      #9

      ...I'm thinking you don't really know the MFC framework?

      L 1 Reply Last reply
      0
      • O Ozer Karaagac

        As far as I understand your question, you can access it like below.

        ((CPipeLineApp*)AfxGetApp())->dgDlg;

        A Offline
        A Offline
        Albert Holguin
        wrote on last edited by
        #10

        ozer's right... my 5! [i forgot you can rate these!]

        O 1 Reply Last reply
        0
        • A Albert Holguin

          ...I'm thinking you don't really know the MFC framework?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #11

          :( I'am a green hand.

          A 1 Reply Last reply
          0
          • L Lost User

            :( I'am a green hand.

            A Offline
            A Offline
            Albert Holguin
            wrote on last edited by
            #12

            see what ozer wrote above... i think i misunderstood your question, i thought you were trying to access cmainframe from cwinapp, a trivial operation, but you're really trying to access dgDlg (who is owned the cwinapp) from the cmainframe... that's not as trivial (but almost... ;P ) Happy coding! :)

            1 Reply Last reply
            0
            • O Ozer Karaagac

              As far as I understand your question, you can access it like below.

              ((CPipeLineApp*)AfxGetApp())->dgDlg;

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #13

              Thank you for you method! I've got it.:thumbsup: ;) :-D

              A 1 Reply Last reply
              0
              • L Lost User

                Thank you for you method! I've got it.:thumbsup: ;) :-D

                A Offline
                A Offline
                Albert Holguin
                wrote on last edited by
                #14

                don't forget to vote his answer up as good! ...i just had someone come around and downvote some of my posts :mad:

                1 Reply Last reply
                0
                • A Albert Holguin

                  ozer's right... my 5! [i forgot you can rate these!]

                  O Offline
                  O Offline
                  Ozer Karaagac
                  wrote on last edited by
                  #15

                  Thanks. :)

                  Time is never on our side! -- Albert Holguin

                  A 1 Reply Last reply
                  0
                  • O Ozer Karaagac

                    Thanks. :)

                    Time is never on our side! -- Albert Holguin

                    A Offline
                    A Offline
                    Albert Holguin
                    wrote on last edited by
                    #16

                    interesting quote... sounds familiar... :laugh:

                    O 1 Reply Last reply
                    0
                    • A Albert Holguin

                      interesting quote... sounds familiar... :laugh:

                      O Offline
                      O Offline
                      Ozer Karaagac
                      wrote on last edited by
                      #17

                      But, I couldn't find out how I could save it as default in my settings. Do you know how?

                      A L 2 Replies Last reply
                      0
                      • O Ozer Karaagac

                        But, I couldn't find out how I could save it as default in my settings. Do you know how?

                        A Offline
                        A Offline
                        Albert Holguin
                        wrote on last edited by
                        #18

                        Have no idea! ...i've only recently become an active participant in this forum... :doh:

                        1 Reply Last reply
                        0
                        • O Ozer Karaagac

                          But, I couldn't find out how I could save it as default in my settings. Do you know how?

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #19

                          ?I think it will save auto automatically.When close the work space ,it'll warn you.

                          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