|
I will try this and definitely write back
Thank you so much
Aljechin Alexander
|
|
|
|
|
extern CString strGlobal = "Initialization Value";
extern CString strGlobal;
AfxMessageBox(strGlobal);
This gives me an error telling one unresolved external symbol
Regards,
Aljechin Alexander
|
|
|
|
|
You got it backwards.
Put this in exactly ONE source file, your definition of the global variable:
extern CString strGlobal = "Initialization Value";
Put this in the header file, included by all source files that need access to the variable:
extern CString strGlobal;
That should work.
Marriage slows down your coding, a baby slows it down even more!
|
|
|
|
|
Blake Miller wrote: You got it backwards.
I am still not getting it
Please show me in stdafx.h what i should put, in MySample.cpp and MySample.h what I should put? There are about 10 files, say MySample2.h, MySample2.cpp, etc.. in those what I should put? Show me the code please. I have never done this before. Sorry if I am troubling too much.
Regards,
Aljechin Alexander
-- modified at 23:55 Thursday 12th January, 2006
|
|
|
|
|
MySample.H
extern CString strGlobal;
MySample.Cpp
#include "MySample.H"
// declare variable in ONLY one source file
CString strGlobal = "Initialization Value";
MyOtherSample.Cpp
#include "MySample.H"
|
|
|
|
|
Yes, I got it. As ....PJ Arends... said, I put #pragma once in all the .h files and #include "stdafx.h" as the first statement of all the .cpp files. Also I removed #include "PersonDlg.h" statement from the Person.h file. Now it works fine. But I have not changed the compiler option to "Not using percompiled header files..". Just I left it, as it is.
Thanks once again
Sarvan AL
|
|
|
|
|
In the project that i am developing i need to communicate between two and more exe. how can i carry this out?
|
|
|
|
|
There are many ways, it really depends on what your needs are. You can used the clipboard, memory mapped files, pipes, mailslots, DDE, WM_COPYDATA, or windows sockets, etc.
See the articles listed at http://www.codeproject.com/threads/#Inter%2DProcess+Communication[^]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
If I create butons and statics in my normal window they do not match those in my dialogue boxes (the font is different).
I can change the font in main window but I don't know what settings to use. Arial doesn't seem right, anyone know what they should be?
Thanks,
Ali
|
|
|
|
|
|
Thanks for the advice, I will try it out.
Ali
|
|
|
|
|
Hi All
How to pass a function name as argument of another function
eg
void Test()
{
}
main()
{
Do(Test)
}
by
KK
|
|
|
|
|
|
void Test() { printf("test\n"); }<br />
<br />
void Do(void fn()){ fn(); }<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
Do(Test);<br />
return 0;<br />
}
|
|
|
|
|
You don't pass a function name as argument as another function but rather a pointer to a function:
First, you have to describe what is the 'type' of the function, for example:
typedef void (MyFunc*) (int,int);
This is a typedef that says that MyFunc is a type definition of a function returning nothing (the first void before (MyFunc*) ) and that takes two integer arguments (the argument list is specified after (MyFunc*) ).
Then, you can use MyFunc as a standard argument to a function:
void Do(MyFunc MyFuncThatWillBePassed)<br />
{<br />
}
This explain that the Do function will receive a pointer to a function of the type MyFunc as argument.
Inside your Do function, when you want to call your function, simply do that:
void Do(MyFunc MyFuncThatWillBePassed)<br />
{<br />
int a=0,b=0;<br />
MyFuncThatWillBePassed(a,b);<br />
}
Warning: you have to respect of course the type of the function and so you NEED to pass two integers (in our case) to your function otherwise you will have compile errors.
Hope this helps
|
|
|
|
|
it should be
typedef void (*MyFunc) (int,int);
|
|
|
|
|
Ooops... Sorry typo mistake
|
|
|
|
|
Hi
Thanx for all answers
by
KK
|
|
|
|
|
My Google skills are failing me this evening; does anyone have any examples or pointers for creating Sticky windows? Basically what I want is to create dialogs that stick to each other like Win Amp’s play list editor and its main dialog.
Any help is appreciated.
ZeePain! wrote: This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.
thedailywtf.com[^]
|
|
|
|
|
Tried a search on CP with "docking windows" ?
~RaGE();
|
|
|
|
|
Rage wrote: "docking windows"
Funny about a minute ago it dawned on me to change my search params. Low and behold there is all kinds of info. Gee
Thank you for the reply.
ZeePain! wrote: This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.
thedailywtf.com[^]
|
|
|
|
|
I have a .DBF file. Is it possible to do some database operation on this file using ODBC on some machine where SQL Server is not installed? If so can you show me a small code sample? (The application that i use is written in Visual C++ 6.0)
Thanks
Aljechin Alexander
|
|
|
|
|
ODBC is just an interface - it has no engine for SQL Server.
|
|
|
|
|
Google Web accelerator highlights prefetched links with a double-underline, but I dont see the web page being modified. I know this application is a BHO, so can someone tell me how can a BHO modify the look and feel of the web page?
PS: What is the difference between BHO and a add-on?
thanks!
|
|
|
|
|
A BHO can basically do whatever it wants :p
A BHO sits in the browser app, thats outside the page, and add-ons are embedded in the page. For that reason BHOs has a wider view of things.
|
|
|
|