|
1) Create a header file for the module (.cpp file) containing the global variable.
2) Declare the variable as follows in the header file for your module (.cpp file) as follows:
extern int g_iMyCurSel;
3) Include the header file for your module (.cpp file) before any other header files that needed to have access to your global variable.
Now any file that includes you modules (.cpp files) header file will have access to you global variable.
Trust in the code Luke. Yea right!
|
|
|
|
|
|
If there is a true need for it and you comment it then why not use a global?
There is a reason why global variables work.
Lots of people blindly assume that globals are "BAAAAAAAD!!!!" but if that variable is truly needed across multiple source files then just use a global and be done with it.
Buuuuuuuuuuuuuuuuuuuuuut - 99% of the time the reason you now "need" a global is that there is some structural faults with the design of your application.
I'm going to live forever or die trying!
|
|
|
|
|
Hi
How can I know that a set of VB function is part of COM object?
Ehsan Behboudi
|
|
|
|
|
i need to develop a basic firewall in vc++ which will restrict access to all ports except port 80. how should i go about it?
|
|
|
|
|
Why go thru the hassle? If closing off everything but port 80 is what you want, why not just use a commercially available product?
RageInTheMachine9532
|
|
|
|
|
Or, using W2K and XP, you can do port filtering right within the network driver setup.
onwards and upwards...
|
|
|
|
|
Hi I am working with several hardware, some of them support VC++ and others support VB.
Is there any way I could write a VC++ program and be able to call VB function in that as well?
Thanks
Ehsan Behboudi
|
|
|
|
|
If VB function is part of COM object yes, otherwise no.
|
|
|
|
|
How can I check that out?
I don't know much about COM object
The VB code is to control motion control/data aquisition hardware.
Ehsan Behboudi
|
|
|
|
|
hi,
You Can Use VB Functions In VC++ Program From VB Activex Dll. First Create VB Activex Dll as VB-GlobalMultiUse
Then Call VB Activex Dll From VC++
Leo12
|
|
|
|
|
how can I make a VB activeX DLL in .NET?
Ehsan Behboudi
|
|
|
|
|
Dear Friend,
You Can Go Through This Page
It Will Help How To Create an Activex Dll In Vb
and How To call From VC++
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_11233681.html
|
|
|
|
|
Is there a function to get the HINSTANCE from a HWND???
I've got a COM DLL (which I use in VB) and I've made a function in it, but I need the HINSTANCE from the VB Form, I only know the HWND from the VB form and not the HINSTANCE so how can I get it??
|
|
|
|
|
Why do you need a HINSTANCE in VB?
As for you question you probably can use ::GetWindowThreadProcessId / ::EnumProcessModules and go from there
|
|
|
|
|
I'm making a game engine in C++ which you can use in VB and DirectInput needs an HINSTANCE to init so...
|
|
|
|
|
HINSTANCE hInst = GetWindowLong(hWnd,GWL_HINSTANCE);
Look up GetWindowLong() in the MSDN Library for usage.
Trust in the code Luke. Yea right!
|
|
|
|
|
I created a stuct in a class and I need a function that returns the pointer to that struct.
I need to be able to access the elements in the structure.
<br />
class MyClass{<br />
struct a {<br />
char arr[10];<br />
double dub[10];<br />
}<br />
<br />
<br />
function that returns the pointer to struct a<br />
void returnPointer(){<br />
return pointer?????;<br />
}<br />
}<br />
-------------------------<br />
<br />
(From another class)<br />
MyClass::returnPointer();<br />
a.arr[1];
Do I need to make a struct in the class that is calling the function in order to access the elements
by casting the pointer to the struct?
As you can see I am a bit lost on how to do this.
sj
|
|
|
|
|
if you asking about syntax
struct MyClass::a* returnPointer(){return pointer?????;}
if you asking what you should return - you need to declare private/protected member of that type and return pointer to it.
|
|
|
|
|
Are you saying that in the class that I call the function from, I need to declare a private struct just like the one in MyClass?
Then call the function and cast it to that private struct pointer?
thanks,
sj
|
|
|
|
|
I am not completely sure what you asking.
what I meant is :
class A
{
public:
typedef struct B{...}B;
const B* getMyDatamember() const {return &b;}
private:
B b;
};
|
|
|
|
|
Hi all, does anyone know how to make an application delete itself? I am making an uninstaller and want to disconnect the memory linkage from the application file, any sites or scraps of info would be appreciated.
Cheers, Alan.
|
|
|
|
|
|
Your a true star John, thankyou very much mate, its exactly what I'm looking for. Most of the articles I've come accross need to reboot before the changes come into effect. Excellent, made my day,
Cheers, Alan.
|
|
|
|
|
Read this (Jeffrey Richter article. See Figure1 in that article)
|
|
|
|