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. make data retrieved once, and be available to the whole application

make data retrieved once, and be available to the whole application

Scheduled Pinned Locked Moved C / C++ / MFC
questionwindows-admin
6 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.
  • M Offline
    M Offline
    Mohammad Tarik
    wrote on last edited by
    #1

    I have to read some data from the registry, and will need to use it several times in probably all the parts of my application. So instead of reading it from the registry every time I need it, I would like to read it once and make it available to all the application parts. How can I do that? :confused:I thought about the Document class but I have more dialogs that can't access this one. Thanks

    T G 2 Replies Last reply
    0
    • M Mohammad Tarik

      I have to read some data from the registry, and will need to use it several times in probably all the parts of my application. So instead of reading it from the registry every time I need it, I would like to read it once and make it available to all the application parts. How can I do that? :confused:I thought about the Document class but I have more dialogs that can't access this one. Thanks

      T Offline
      T Offline
      ThomasABBE
      wrote on last edited by
      #2

      create a registry class with static member variables.

      M 1 Reply Last reply
      0
      • M Mohammad Tarik

        I have to read some data from the registry, and will need to use it several times in probably all the parts of my application. So instead of reading it from the registry every time I need it, I would like to read it once and make it available to all the application parts. How can I do that? :confused:I thought about the Document class but I have more dialogs that can't access this one. Thanks

        G Offline
        G Offline
        Gary R Wheeler
        wrote on last edited by
        #3

        Make the data global. The simplest thing to do is to place it in stdafx.h, marking the declarations with the extern keyword. In the main program, where you retrieve the data from the registry, repeat the declarations without the extern keyword.


        Software Zen: delete this;

        M 1 Reply Last reply
        0
        • T ThomasABBE

          create a registry class with static member variables.

          M Offline
          M Offline
          Mohammad Tarik
          wrote on last edited by
          #4

          I was thinking in CWinApp and CDocument, and forgot that I can make my OWN class. :-O :-O Thanks :rose:

          1 Reply Last reply
          0
          • G Gary R Wheeler

            Make the data global. The simplest thing to do is to place it in stdafx.h, marking the declarations with the extern keyword. In the main program, where you retrieve the data from the registry, repeat the declarations without the extern keyword.


            Software Zen: delete this;

            M Offline
            M Offline
            Mohammad Tarik
            wrote on last edited by
            #5

            Done it with this method in 3 minutes. :omg: :-D Thanks a lot :rose:

            G 1 Reply Last reply
            0
            • M Mohammad Tarik

              Done it with this method in 3 minutes. :omg: :-D Thanks a lot :rose:

              G Offline
              G Offline
              Gary R Wheeler
              wrote on last edited by
              #6

              You're welcome. :)


              Software Zen: delete this;

              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