That's it! Thanx! Dr-Kuulun
Dr Kuulun
Posts
-
return value of = operator -
return value of = operatorHi, what is the reason for the Cxyz& return value with *this parameter of = operators? Dr-Kuulun
-
Deriving from CObject and using = operatorYes it is wrong. Both objects should be instances from the last derrived class type CB. Dr-Kuulun
-
CLisrctrlI can't find what is wrong. But you should place the while-statement at the beginning of the loop. Your loop will show wrong data or crashes if you open an empty file. Dr-Kuulun
-
= operator in CObject-derived classesBut the operator is represented by a function. Functions can be virtual. Why is it not possible for an operator? Now I wrote a virtual clone-function an the list class calls this function to copy the elements. This way works fine. Dr-Kuulun
-
= operator in CObject-derived classesHello, I wrote one post this day to my problem. Now I am able to describe my problem more detailed. So once more: I want to write a base class and a class that manage a list of objects derived from my base class. The list-class should have a = operator that copies the whole list and creates copies of all its elements (derived from base class). The base class is derived from CObject because of serialisation and so on. It also includes some basic methods and members.
class CBase::Cobject { .... }
Now I derive some classes from it.class CA::CBase { } class CB::CBase { }
All classes should have a = operator to copy its elements! The list-class now have a list of pointers to some instances from CA und CB in a CObArray. The = operator of the list-class shoud create a copy of the list an the members.CBase* pElement1; CBase* pElement2; CRuntimClass* pRTC; int nIndex; for (nIndex=0; nIndexGetCount(); nIndex++) { pElement1 = pList->GetAt(nIndex); pRTC = pElement1->GetRuntimeClass(); pElement2 = (CBase*)pRTC->CreateObject(); pRTC = pElement2->GetRuntimeClass(); *pElement2 = *pElement1; Add(pElement2); }
pList is a pointer to the source CObArray-Object. Add() adds an element in the destination CObArray-Object. Now the problem: *pElement2 = *pElement1 do not call the = operator of CA or CB. The = operators have no virtual behaviour. The result ist that not all elements (CBase and CA/CB) are copied. Only the = operator of CBase is called. What is to do? And how can i call in the = operator function of CA the = operator funrction of CBase to copy the base elements? And one more question: What is the reason for the Cxyz& return type of the = operators and the return(*this) statement? Thanx Dr-Kuulun -
Deriving from CObject and using = operatorHello, how is the = operator to be implemented in a class derived from CObject? I derived two classes with one element inside:
class CA : CObject { int a; void operator = (const CA& src) {}; } class CB : CA { int b; }
The first class overwrites the = operator with an empty function. The following code has a mystic result:CA obA; CB obB; obA.a=1; obA.b=2; obB=obA;
The element b is copied, a not. Why? And what do the = operator in CObject? Why is b copied? Do I have to implement the operator in Class CB too? Many questions no answer! Thanx Markus Dr-Kuulun -
Adobe DistillerI forgot my code:
CDC dc; dc.CreateCompatibleDC(pDC); CBitmap b; b.LoadBitmap(IDB\_BITMAP1); dc.SelectObject(&b); pDC->StretchBlt(100,100,200,200,&dc,0,0,48,48,SRCCOPY); pDC->MoveTo(0,0); pDC->LineTo(100,100);
The line is visible but not the bitmap. Dr-Kuulun
-
Adobe DistillerHi, I have a problem with the output of CBitmap images to Adobe Distiller. I can see my bitmap in the view and the preview. Printing is also fine. But the output into pdf does not work. Text and other graphics like lines or boxes works fine, only bitmaps are not visible. Is there anybody with a solution in the world? Greetings from Hannover, Germany Markus Dr-Kuulun
-
Carray doubtHi, i had the same problem and it seems to be impossible. i created a lot of instances of my class with 'new' and than i stored the pointers in an CObList or CObArray. This array stores only the pointers, so clean the memory up ('delete pClass') when deleting the array. Dr-Kuulun
-
version and problem with mscomm32hi, is the someone who knows the actual version of the mscomm32.ocx control? where can i search for a new release? i have problems with the parity option. after an undefined time of work the control sends only the parity replace char to my software. when i close and start the port again the problem is cleared until it occurs again. this problem happens mainly on laptops. i checked the correct bit stream with an oscilloscope. the bit stream is at any time correct. did you recognize the same problem? Dr-Kuulun
-
How to select the entire row in CListControlhi, i think it is impossible. you can only select one or more cols. Dr-Kuulun
-
Serial Porthi, use the activex control mscomm! this will solve all your problems. markus Dr-Kuulun