regarding CObject and CTypedPtrArray
frens m a newbie to vc++ enviornment.....m designin a project for gui ....m nt sure do how to use a template in dis do v need to include ne of pre defined class or nt
my problm are:
1.wen defining a class by class wizard m nt getting CObject as base class to select??
2.aldo i selectd class CCmdTarget as base class for defining my base class which class shall i use as v use CObarray for CObject class??
wen m writting a statement as
CTypedPtrArray<CObArray, CBus*>m_array;
m getting 12 errors in d sam line as
missing ; b4 <
CTypedPtrArray : missing storage class or type specifier
etc etc....
frens plzz help me out sinc have 2 submit dis project...
thanx
Re: regarding CObject and CTypedPtrArray
I can't read your post. Get rid of the messenger talking and write in plain English.
Re: regarding CObject and CTypedPtrArray
Well the problem is that am unable to declare a array as
CTypedPtrArray<CCmdTarget, CBus*>m_array;
also am unable to declare a class using class wizard having CObject as its base class the dropdown does not contain CObject as one of its options.....
Re: regarding CObject and CTypedPtrArray
1. Please show the exact error messages.
2. Read MSDN about CTypedPtrArray and its using (particularly, Requirements section)
Re: regarding CObject and CTypedPtrArray
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2143: syntax error : missing ';' before '<'
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2501: 'CTypedPtrArray' : missing storage-class or type specifiers
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2059: syntax error : '<'
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2238: unexpected token(s) preceding ';'
PflowDoc.cpp
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2143: syntax error : missing ';' before '<'
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2501: 'CTypedPtrArray' : missing storage-class or type specifiers
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2059: syntax error : '<'
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2238: unexpected token(s) preceding ';'
PflowView.cpp
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2143: syntax error : missing ';' before '<'
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2501: 'CTypedPtrArray' : missing storage-class or type specifiers
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2059: syntax error : '<'
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2238: unexpected token(s) preceding ';'
Generating Code...
Error executing cl.exe.
Pflow.exe - 12 error(s), 0 warning(s)
and line(25) is
CTypedPtrArray<CCmdTarget, CBus*>m_array;
this is declared in doc header file my project....
thnx
Re: regarding CObject and CTypedPtrArray
Quote:
Originally Posted by
pinnachio
...
f:\myprojects\pflow\pflow\pflowdoc.h(25) : error C2501: 'CTypedPtrArray' : missing storage-class or type specifiers
As I already pointed out:
Quote:
Originally Posted by
VictorN
2. Read MSDN about CTypedPtrArray and its using (particularly, Requirements section)
Re: regarding CObject and CTypedPtrArray
thanz a lot......
the problem was der only where u pointed i had not included afxtempl.h in my file......
Re: regarding CObject and CTypedPtrArray
kindly please tell can i derive a class from CObject class using class wizard,basically i want to use dis class only for serialization...
Re: regarding CObject and CTypedPtrArray
Yes, I can do it (add MFC class derived from CObject) using class wizard in VS 2008.
In VC++6.0 CObject dos not appear in a list of MFC classes available for deriving. However, you could create a new class as a *generic* class and set CObject as a base class.
Re: regarding CObject and CTypedPtrArray
thnx Victor for that 1 too..........am here with another problem
i have to draw some shapes on a layout through the application am designing the code in some what it goes as....
if(bCheckBusVer==1)
{
if(pDoc->AddBus(p.x-3,p.y-5*s,p.x+3,p.y+5*s,atol(m_BusNo),0,m_BusType,m_Volts,m_LoadAngle,m_BusName))
{
int index = pDoc->GetNumBus();
pDoc->GetBus(--index)->Bus_Draw(pDC);
}
else
{
bCheckBusOpt=FALSE;
ReleaseCapture();
return;
}
}
if(bCheckBusHor==1)
{
if(pDoc->AddBus(p.x-5*s,p.y-3,p.x+5*s,p.y+3,atol(m_BusNo),1,m_BusType,m_Volts,m_LoadAngle,m_BusName))
{
int index = pDoc->GetNumBus();
pDoc->GetBus(--index)->Bus_Draw(pDC);
}
else
{
bCheckBusOpt=FALSE;
ReleaseCapture();
return;
}
and bus_draw(pDC) as
char temp[10];
ltoa(m_BusNo,temp,10);
if(m_bOrien)
pDC->TextOut(m_x2+2,m_y2+4,temp);
else
pDC->TextOut(m_x1-2,m_y1,temp);
COLORREF color=pDC->GetBkColor();
pDC->FillSolidRect(m_x1,m_y1,m_x2,m_y2,RGB(0,0,255));
pDC->SetBkColor(color);
the problem is when i run the code and enter the same set of values for size different size of rectangles are made...... ..plzz help me out am gettin sick of this....
Re: regarding CObject and CTypedPtrArray
The code you've posted is absolutely unreadable. Please, edit your post adding Code tags around code snippet.
Read about Code and other tags