Re: Global objects
- From: "Bruno van Dooren" <bruno_nos_pam_van_dooren@xxxxxxxxxxx>
- Date: Fri, 10 Mar 2006 12:30:48 +0100
"Alur" <Alur@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F18FDE9A-C98F-4BFC-A249-BDFA2EEEA8CF@xxxxxxxxxxxxxxxx
My VC++6 MFC exe project has many dialogs, menus .
It's necessary to have many global variables and objects.
For example, CRecordset objects(for different kind of server tables)
because it takes many time to load big tables
from a database for the each dialog box.
Could you tell me how and
where can I initialize them once in the app beginging and
use them many times from the different part of my application ?
Thanks in advance.
declare your globals as extern in your main header file (eg. extern int i;).
define them in you main cpp file (eg. int i;).
that way they are located in the main cpp file and available to all classes
that include your main h file.
the main h and cpp files generally have the same name as the project.
normally your main cpp file has an implementation of the InitInstance
method. in that method you can initialize all globals just before your main
window is shown. that way all classes that use your global can safely do so
once the main window is running.
--
Kind regards,
Bruno.
bruno_nos_pam_van_dooren@xxxxxxxxxxx
Remove only "_nos_pam"
.
- Prev by Date: Re: DirectShow with VS2005
- Next by Date: Re: Global objects
- Previous by thread: DirectShow with VS2005
- Next by thread: Re: Global objects
- Index(es):
Relevant Pages
|