|
I answered a question similar to this one a while back. Look here.
Regards,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
put forward declarations in the Class1.h and Class2.h files and only add the include directives in the cpp files.
class Class2;
class Class1
{
Class2* p;
};
and
class Class1;
class Class2
{
Class1* p;
};
Max.
|
|
|
|
|
I just can't.
Class1.h needs definitions for CClass2 and Class2.h needs definitions for CClass1
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
frisco wrote:
Class1.h needs definitions for CClass2 and Class2.h needs definitions for CClass1
Forward declaration will tell the compiler to expect this class definition later and allow it's use now
Class CClass2; // Fwd declared, but not defined yet
Class CClass1
{
// Stuff
// Ref to class 2 here
};
Class CClass2
{
// Other stuff
// Ref to class 1 here
};
Paresh Solanki
hombre que trabaja pierde tempo precioso "The man who works is losing precious time." Vuemme
|
|
|
|
|
Then your design is broken. Change your design to not have a circular dependency.
|
|
|
|
|
been there.fixed that.
follow the steps.
1.choose one class to be a pointer say class2.In class2.h after the include guards-
2. class class1;
class class2 - declaration
3. #include"class1.h" - definition
now class 2 need not use a pointer
class1 class2::m_class1 will work.
If you still need a pointer just use it.
In class1.h,again declare
class class2
now
class2* class1::m_pclass2 will work
-cu
|
|
|
|
|
If i want to save a bitmap to the disk, i first write BITMAPFILEHEADER struct to the disk and then a BITMAPINFO struct, but where do i specify the colors? I have an array of RGBQUAD's that contain all the colors but where do i specify them?
Thanks
|
|
|
|
|
the palette comes after the BITMAPINFOHEADER struct and before the pixel data
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
What is a palette, and in what struct to i specify the pixel data?
Thanks in advance.
|
|
|
|
|
a palette is what you use to define the colors for a colormapped image (1,4 or 8 bits per pixel). if you're writing a 24 or 32 bpp BMP/DIB, you don't need a palette. in a BMP/DIB, the palette is the set of (up to) 256 RGBQUADs after the BITMAPINFOHEADER. after that comes the image data, formatted in any of a dozen or more ways, depending on bit depth, compression , JPG , PNG, etc..
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
I need to retrieve, at run-time, the path of my application (the place where the user has put the executable file, place that is not fixed). Does someone know how I can do that ???
Thank a lot !!!
|
|
|
|
|
see ::GetModuleFileName
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
My app uses serial comms to collect data, it runs perfectly on my 1.1G Celeron XP machine, but when I tested it on a Cyrix PR233 running Win98 it crashes. After several hours of running OK it gives an error, which is 'Invalid Handle' - for the comm port.
What could cause it to loose the handle for the comm port?
Is it more likely to be the PC that is the critical difference or the operating system?
Anyone else had problems like this?
I've written the serial comms from a simple example, are there any good libraries or stuff that I could use that would make it more robust? Any recommendations?
Ali
|
|
|
|
|
Go to the msdn.microsoft.com and search for MTTTY (yep 3xT .. not a typo)
Just follow the example and you've got a great running app.;P
|
|
|
|
|
Hi, all
i added a datagrid control(Microsoft DataGrid Control version6.0(oledb)) to my dialog, but i don't know how to set the values in the cells, should i call something before i call SetText()?
Thanks;)
|
|
|
|
|
You dont need to call anything before SetText()...
just make sure you have set the control variable for the Grid and that you are in the correct cell that you want to set your text to.
If you want a helping hand, you'll find one at the edof your arm.
|
|
|
|
|
but what "the control variable for the grid" should be set? could u provide some simple code?;)
|
|
|
|
|
Hi,
I'd like to replace CreateThread() with beginthreadex() , but I get an unknown identifier error.
process.h is included, anything else I need to do?
|
|
|
|
|
|
You must link with the multithreaded lib , or else you get errors ..
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
Joao Vaz wrote:
You must link with the multithreaded lib , or else you get errors ..
ah yes, found it. thx!
Can I use a pragma to link with the multithreaded DLL? Something like #pragma comment(lib, "xxx.lib") , what do I need to set for xxx?
Which alternative is better: 'Multithreaded' or 'Multithreaded DLL'? Last one makes executable much smaller, does it run on Win9x/2000/XP still?
|
|
|
|
|
I'll use something like this:
BOOL createthread(HTHREAD* phThread, ThreadStartFunction pThreadFunc, void* pThreadParameter)
{
assert(phThread && !*phThread);
#ifdef _MT
unsigned int nDummy;
*phThread = (HTHREAD) _beginthreadex(NULL,0,pThreadFunc,pThreadParameter,0,&nDummy);
#else
unsigned long lDummy;
*phThread = CreateThread(NULL,0,pThreadFunc,pThreadParameter,0,&lDummy);
#endif
return *phThread?TRUE:FALSE;
}
|
|
|
|
|
Hi guys, I need a few pointers on file associations. I'm trying to write an app that decrypts files of a certain file extension, lets's say the extension is ".abc". I want that when someone clicks on the encrypted file, say "MyEncryptedFile.abc", it is opened via my decryptor. My question is, do I need to pass that file name to my decryptor exe and if so...how? Or, is there no need for this since files of type ".abc" are associated with my exe?
Hope that makes sense.
Senkwe
Just another wannabe code junky
|
|
|
|
|
Senkwe Chanda wrote:
My question is, do I need to pass that file name to my decryptor exe and if so...how?
It depends on how you have set up the string in the registry.
For an example see :-
HKEY_CLASSES_ROOT\txtfile\shell\open\command
It'll show you how a txt file is opened by notepad
The value is :-
%SystemRoot%\system32\NOTEPAD.EXE %1
Thus the %1 will automatically be sent to notepad.exe as a cmdline parameter where %1 is the file that has been double-clicked or opened from explorer
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
|
|
|
|
|
Thanks Nishant, am I limited to only passing through the filename? Suppose I required two command line parameters for the exe, the file name and a password for example.
If you can, please point me to a good site where I can get more info on the topic.
Regards
Senkwe
Just another wannabe code junky
|
|
|
|