a simple simple question... 
Author Message
 a simple simple question...

hi all,

I'm new to evc,
I would like to know how to create a global variable and put value in it??

I've tried creating a pulic member varible in theApp,
and set   theApp.m_var=myvalue when I click an button,
but the error says theApp is undefined....

so, what should I do ??



Sun, 09 Oct 2005 11:16:56 GMT  
 a simple simple question...

Your idea of using theApp is good. The only thing you need is to declare
theApp object in the module where you want to use it. To do this, include
the header containing theApp declaration in that module. Wizard usually
places this declaration in <project_name>.h file.

You can also create a global var, not member of CWInApp-derived class. To do
this:

1. define your var in _one_ cpp-file, e. g.:
int g_var;

2. declare your var in each module where you want to use it, e. g.:
extern int g_var;
(you can place this declaration in some header and #include it whenever
necessary)

3. use the var, e. g.:
g_var = 0;

--
Sincerely,
Alexander


http://www.RSDN.ru - Russian Software Developer Network


Quote:
> hi all,

> I'm new to evc,
> I would like to know how to create a global variable and put value in it??

> I've tried creating a pulic member varible in theApp,
> and set   theApp.m_var=myvalue when I click an button,
> but the error says theApp is undefined....

> so, what should I do ??



Sun, 09 Oct 2005 14:27:43 GMT  
 a simple simple question...
i can do now, thank you!!


Quote:

> Your idea of using theApp is good. The only thing you need is to declare
> theApp object in the module where you want to use it. To do this, include
> the header containing theApp declaration in that module. Wizard usually
> places this declaration in <project_name>.h file.

> You can also create a global var, not member of CWInApp-derived class. To
do
> this:

> 1. define your var in _one_ cpp-file, e. g.:
> int g_var;

> 2. declare your var in each module where you want to use it, e. g.:
> extern int g_var;
> (you can place this declaration in some header and #include it whenever
> necessary)

> 3. use the var, e. g.:
> g_var = 0;

> --
> Sincerely,
> Alexander


> http://www.RSDN.ru - Russian Software Developer Network



> > hi all,

> > I'm new to evc,
> > I would like to know how to create a global variable and put value in
it??

> > I've tried creating a pulic member varible in theApp,
> > and set   theApp.m_var=myvalue when I click an button,
> > but the error says theApp is undefined....

> > so, what should I do ??



Sun, 09 Oct 2005 18:19:03 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. simple simple print question

2. simple lib and simple dll

3. Calling a simple FORTRAN subroutine from my simple C program

4. Simple problem across processes - need simplest answer

5. Simple ATL Com object problem on simplest examples

6. Simple But Not Too Simple

7. Simple MAPI: Not so simple:(

8. Newbie: CATALOG sample question (SIMPLE question)

9. A simple question, but still no answer

10. Simple question

11. Simple Question regarding C# file creation

12. Two Simple Question

 

 
Powered by phpBB® Forum Software