Click here to Skip to main content
15,901,505 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: MAPS Pin
sameer224-Feb-07 6:55
sameer224-Feb-07 6:55 
AnswerRe: MAPS Pin
Waldermort4-Feb-07 7:19
Waldermort4-Feb-07 7:19 
AnswerRe: MAPS Pin
Hamid_RT4-Feb-07 7:43
Hamid_RT4-Feb-07 7:43 
GeneralRe: MAPS Pin
sameer224-Feb-07 8:27
sameer224-Feb-07 8:27 
GeneralRe: MAPS Pin
Hamid_RT4-Feb-07 8:30
Hamid_RT4-Feb-07 8:30 
AnswerRe: MAPS Pin
ThatsAlok6-Feb-07 20:18
ThatsAlok6-Feb-07 20:18 
QuestionUnable to create an automation project using MFC and a type library Pin
milltooth4-Feb-07 5:35
milltooth4-Feb-07 5:35 
QuestionGlobal variables [modified] Pin
Makakuin4-Feb-07 5:05
Makakuin4-Feb-07 5:05 
Hi! I`m creating a dialog based application with one main dialog containing TabCtrl each of tabs in TabCtrl contain individual dialog. This application will be used for ticket printing in a museum and each tab is for different ticket type, where you will only need to enter the count of visitors. The ticket prices are held in a database. To avoid the need to access database each time the price of a ticket needs to be read, I want to create a global Struct variable, then on applications InitInstance() read the values in to that variable.

Example:
Struct prices<br />
   {<br />
     double price1;<br />
     double price2;<br />
     double price3;<br />
     double price4;<br />
   };<br />

I tried defining the struct in applications header file, then after class definition in same header I added line:

extern CMyApp::prices price;

Later in applications InitInstance() I call:

CMyApp::prices price;

That way I`m able to access price.price1, price.price2.. etc. in any class.

Iv`e heard about creating seperate class for global variables and then access them like CMyGlobals::Variable...
What is the best way of creating global variables? And what is your opinion of my solution.

Thanx!




-- modified at 11:10 Sunday 4th February, 2007
AnswerRe: Global variables Pin
Waldermort4-Feb-07 6:20
Waldermort4-Feb-07 6:20 
AnswerRe: Global variables Pin
ThatsAlok6-Feb-07 20:19
ThatsAlok6-Feb-07 20:19 
QuestionSaving with property sheet Pin
DanYELL4-Feb-07 4:53
DanYELL4-Feb-07 4:53 
AnswerRe: Saving with property sheet Pin
Mark Salsbery4-Feb-07 9:04
Mark Salsbery4-Feb-07 9:04 
Questionmotion detection Pin
ceejeeb4-Feb-07 3:54
ceejeeb4-Feb-07 3:54 
AnswerRe: motion detection Pin
Waldermort4-Feb-07 6:25
Waldermort4-Feb-07 6:25 
GeneralRe: motion detection Pin
ceejeeb5-Feb-07 1:57
ceejeeb5-Feb-07 1:57 
QuestionGetDlgItemText getting a float Pin
Johpoke4-Feb-07 3:19
Johpoke4-Feb-07 3:19 
AnswerRe: GetDlgItemText getting a float Pin
Waldermort4-Feb-07 6:31
Waldermort4-Feb-07 6:31 
AnswerRe: GetDlgItemText getting a float (SOLVED) Pin
Johpoke4-Feb-07 7:29
Johpoke4-Feb-07 7:29 
AnswerRe: GetDlgItemText getting a float Pin
Hamid_RT4-Feb-07 7:35
Hamid_RT4-Feb-07 7:35 
AnswerRe: GetDlgItemText getting a float Pin
ThatsAlok6-Feb-07 20:19
ThatsAlok6-Feb-07 20:19 
QuestionLocking keyboard and mouse of a computer in the same LAN using C++ or Java Pin
Sara_fjr4-Feb-07 2:35
Sara_fjr4-Feb-07 2:35 
AnswerRe: Locking keyboard and mouse of a computer in the same LAN using C++ or Java Pin
Mark Salsbery4-Feb-07 9:12
Mark Salsbery4-Feb-07 9:12 
GeneralRe: Locking keyboard and mouse of a computer in the same LAN using C++ or Java Pin
Waldermort4-Feb-07 9:23
Waldermort4-Feb-07 9:23 
GeneralRe: Locking keyboard and mouse of a computer in the same LAN using C++ or Java Pin
Sara_fjr4-Feb-07 10:32
Sara_fjr4-Feb-07 10:32 
GeneralRe: Locking keyboard and mouse of a computer in the same LAN using C++ or Java Pin
Waldermort4-Feb-07 11:26
Waldermort4-Feb-07 11:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.