Click here to Skip to main content
15,908,254 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralManipulating Systray icons Pin
haritadala7-Jul-03 14:15
haritadala7-Jul-03 14:15 
GeneralRe: Manipulating Systray icons Pin
Ryan Binns7-Jul-03 15:45
Ryan Binns7-Jul-03 15:45 
Generalsaving and loading application settings Pin
crapfacejoe7-Jul-03 12:44
crapfacejoe7-Jul-03 12:44 
GeneralRe: saving and loading application settings Pin
valikac7-Jul-03 12:54
valikac7-Jul-03 12:54 
GeneralRe: saving and loading application settings Pin
John R. Shaw7-Jul-03 13:12
John R. Shaw7-Jul-03 13:12 
GeneralRe: saving and loading application settings Pin
John M. Drescher7-Jul-03 13:31
John M. Drescher7-Jul-03 13:31 
Generalgetting the value of an int in a cpp file into another Pin
keegan7-Jul-03 9:51
keegan7-Jul-03 9:51 
GeneralRe: getting the value of an int in a cpp file into another Pin
Navin7-Jul-03 9:59
Navin7-Jul-03 9:59 
You could use a global variable, but that's icky.

What you ought to do is declare that integer as a static member variable in a class, and include the header for that class in any CPP that needs it.

e.g. (note, this is just to show the idea how it's done, you should probably have accessor functions instead of making it a public member, but that's beside the point)

(MyClass.h)
class MyClass
{
public:
   static int bob;
...
};

(MyClass.cpp)
// Need this to compile
int MyClass::bob = 0;
...

(SomeOther.cpp)
#include "MyClass.h"

...
void SomeFunc()
{
  int number = MyClass::bob;
  ...
}



"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
GeneralRe: getting the value of an int in a cpp file into another Pin
keegan7-Jul-03 10:11
keegan7-Jul-03 10:11 
GeneralRe: getting the value of an int in a cpp file into another Pin
John R. Shaw7-Jul-03 10:05
John R. Shaw7-Jul-03 10:05 
GeneralRe: getting the value of an int in a cpp file into another Pin
keegan7-Jul-03 10:16
keegan7-Jul-03 10:16 
GeneralRe: getting the value of an int in a cpp file into another Pin
John R. Shaw7-Jul-03 10:41
John R. Shaw7-Jul-03 10:41 
GeneralRe: Simpler answer Pin
John R. Shaw7-Jul-03 10:59
John R. Shaw7-Jul-03 10:59 
GeneralRe: getting the value of an int in a cpp file into another Pin
Michael Dunn7-Jul-03 17:19
sitebuilderMichael Dunn7-Jul-03 17:19 
GeneralRe: getting the value of an int in a cpp file into another Pin
Terry O'Nolley10-Jul-03 9:13
Terry O'Nolley10-Jul-03 9:13 
Questionhow to know if the VB function is part of COM object? Pin
mr20037-Jul-03 9:47
mr20037-Jul-03 9:47 
Generalfirewall project Pin
ub817-Jul-03 9:10
ub817-Jul-03 9:10 
GeneralRe: firewall project Pin
Dave Kreskowiak7-Jul-03 9:12
mveDave Kreskowiak7-Jul-03 9:12 
GeneralRe: firewall project Pin
basementman7-Jul-03 15:56
basementman7-Jul-03 15:56 
QuestionHow to use VB functions in VC program Pin
mr20037-Jul-03 9:10
mr20037-Jul-03 9:10 
AnswerRe: How to use VB functions in VC program Pin
AlexO7-Jul-03 9:11
AlexO7-Jul-03 9:11 
GeneralRe: How to use VB functions in VC program Pin
mr20037-Jul-03 9:14
mr20037-Jul-03 9:14 
GeneralRe: How to use VB functions in VC program Pin
Shaffiq7-Jul-03 18:26
Shaffiq7-Jul-03 18:26 
GeneralRe: How to use VB functions in VC program Pin
mr20038-Jul-03 7:32
mr20038-Jul-03 7:32 
GeneralRe: How to use VB functions in VC program Pin
Shaffiq8-Jul-03 20:34
Shaffiq8-Jul-03 20:34 

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.