Click here to Skip to main content
15,888,816 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to merge resources in VC++ Pin
Kamesh21-Mar-03 1:00
Kamesh21-Mar-03 1:00 
AnswerRe: How to merge resources in VC++ Pin
Willem B21-Mar-03 1:07
Willem B21-Mar-03 1:07 
AnswerRe: How to merge resources in VC++ Pin
¡ºÎú¢â¡»21-Mar-03 1:45
suss¡ºÎú¢â¡»21-Mar-03 1:45 
AnswerRe: How to merge resources in VC++ Pin
KarstenK21-Mar-03 2:35
mveKarstenK21-Mar-03 2:35 
QuestionCan I not use static const when declaring members? Pin
tom7621-Mar-03 0:23
tom7621-Mar-03 0:23 
AnswerRe: Can I not use static const when declaring members? Pin
Neville Franks21-Mar-03 0:46
Neville Franks21-Mar-03 0:46 
GeneralRe: Can I not use static const when declaring members? Pin
tom7621-Mar-03 1:06
tom7621-Mar-03 1:06 
GeneralRe: Can I not use static const when declaring members? Pin
jhwurmbach21-Mar-03 3:34
jhwurmbach21-Mar-03 3:34 
tom76 wrote:
I believe I need a global because I only want one instance of this object, because the members will never change value.

Would it be better to make your variables (which seem to be constants) constant members of the Application-class? So you can access them (almost) everywhere in your program and yet they are not global.
Example:
Yourapp.h

class CYourapp : CApp
{
[...].public:
  const int m_One;
  const int m_Two;
[...].}

Yourapp.cpp
[...]
CYourapp::m_One = 1;
CYourapp::m_Two = 2;
[...].

Use in either of this ways:
int i = theApp.m_One;
int j = static_cast<CYourApp*>(AfxGetApp())->m_Two;



My opinions may have changed, but not the fact that I am right.
GeneralRe: Can I not use static const when declaring members? Pin
tom7621-Mar-03 3:49
tom7621-Mar-03 3:49 
GeneralRe: Can I not use static const when declaring members? Pin
catchnine21-Mar-03 5:55
catchnine21-Mar-03 5:55 
AnswerRe: Can I not use static const when declaring members? Pin
John R. Shaw21-Mar-03 7:10
John R. Shaw21-Mar-03 7:10 
GeneralRe: Can I not use static const when declaring members? Pin
tom7621-Mar-03 8:00
tom7621-Mar-03 8:00 
QuestionHow to create a window please help Pin
Jump_Around20-Mar-03 23:29
Jump_Around20-Mar-03 23:29 
AnswerRe: How to create a window please help Pin
Michael P Butler21-Mar-03 0:07
Michael P Butler21-Mar-03 0:07 
GeneralRe: How to create a window please help Pin
Jump_Around21-Mar-03 0:26
Jump_Around21-Mar-03 0:26 
GeneralStarting Up Books Pin
BZZR20-Mar-03 23:24
BZZR20-Mar-03 23:24 
GeneralRe: Starting Up Books Pin
Le Ridder Noir20-Mar-03 23:43
Le Ridder Noir20-Mar-03 23:43 
GeneralRe: Starting Up Books Pin
Paul Ingles21-Mar-03 1:09
Paul Ingles21-Mar-03 1:09 
GeneralRe: Starting Up Books Pin
valikac21-Mar-03 6:06
valikac21-Mar-03 6:06 
GeneralRe: Starting Up Books Pin
BZZR21-Mar-03 8:16
BZZR21-Mar-03 8:16 
GeneralRe: Starting Up Books Pin
John R. Shaw21-Mar-03 10:11
John R. Shaw21-Mar-03 10:11 
GeneralRe: Starting Up Books Pin
georgiek5021-Mar-03 13:40
georgiek5021-Mar-03 13:40 
GeneralRe: Starting Up Books Pin
John R. Shaw21-Mar-03 20:13
John R. Shaw21-Mar-03 20:13 
GeneralAdding icon in the statusbar... Pin
Daniel Strigl20-Mar-03 23:21
Daniel Strigl20-Mar-03 23:21 
GeneralRe: Adding icon in the statusbar... Pin
Le Ridder Noir20-Mar-03 23:49
Le Ridder Noir20-Mar-03 23:49 

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.