Click here to Skip to main content
15,896,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRE: OnDraw, how can I get the rectangle that is painting ? Pin
Henk Devos23-Nov-99 9:33
Henk Devos23-Nov-99 9:33 
AnswerRE: OnDraw, how can I get the rectangle that is painting ? Pin
Anonymous24-Nov-99 14:56
suss Anonymous24-Nov-99 14:56 
GeneralTrying to print with a CWinThread... Pin
Braulio Diez23-Nov-99 1:18
sussBraulio Diez23-Nov-99 1:18 
GeneralCHtmlView Pin
Thierry Mathieu22-Nov-99 20:50
sussThierry Mathieu22-Nov-99 20:50 
GeneralBasic OOP question... Pin
Braulio Diez22-Nov-99 20:32
sussBraulio Diez22-Nov-99 20:32 
GeneralRE: Basic OOP question... Pin
Paul Selormey22-Nov-99 20:55
Paul Selormey22-Nov-99 20:55 
GeneralThanks but... Pin
Braulio Diez22-Nov-99 21:20
sussBraulio Diez22-Nov-99 21:20 
GeneralRE: Thanks but... Pin
Henk Devos23-Nov-99 9:27
Henk Devos23-Nov-99 9:27 
I suppose you get the compiler error in a IMPLEMENT_DYNCREATE macro.
When you want to be able to create the thread with AfxBeginThread, your thread gets instantiated for you and therefore MFC will call the constructor. The logic for this is in CObject//CreateObject i believe.
The MFC logic has no way to pass parameters to your c onstructor, so whenenver you use a DECLARE_DYNCREATE macro you need a default constructor.

==================
The original message was:

Thanks but...,

Sorry, the problems that I have are with the following derived class:

class CDrawToScreenThread : public CGeneralDrawingThread
{

CDrawToScreenThread (){} // I f not, give a compiler error
CDrawToScreenThread (CWnd *pWnd, ScreenParam ScreenParams); // My constructor with params...
}
}




==================
The original message was:

Hello,

You should have posted some codes. From the written it seems you are using a constructor with parameters as if it is one without a parameter. For the one with the parameter, when creating an instance of the object you need to supply the parameters. For example,

class Basic
{
Basic(int nOne);
....
}

Here you cannot say...
Basic* pBasic = new Basic; // since nOne is not known
Basic theBasic;

You will have to say
Basic* pBasic = new Basic(1111); // for instance
Basic theBasic(1111);

For the definition
class Basic
{
Basic();
......
}

You can write...
Basic theBasic;
Basic* pBasic = new Basic;
OR Basic* pBasic = new Basic();

I hope this clears the problem. If it does, then consider a little more study of constructors/destructors.

Bye,
Paul.


==================
The original message was:

Hi,

I have a basic OOP question, I have a class ( a base class, and don't inherits from CObject), and I want to have a constructor with some parameters, I make this, but when I want to compile it without errors I have to add an empty constructor without parameters. Why must I do this ? Have I made something wrong ?

Thanks, Bye !
Braulio
GeneralRE: Basic OOP question... Pin
sandrine22-Nov-99 22:07
sandrine22-Nov-99 22:07 
GeneralRE: RE: Basic OOP question... Pin
Braulio Diez23-Nov-99 1:57
sussBraulio Diez23-Nov-99 1:57 
GeneralRE: RE: RE: Basic OOP question... Pin
Anonymous23-Nov-99 7:41
suss Anonymous23-Nov-99 7:41 
GeneralRe: Basic OOP question... Pin
Member 147421-Apr-00 11:01
Member 147421-Apr-00 11:01 
GeneralDebugging Control Panel Applets Pin
Farzad Bakhtiar9-Apr-00 21:56
sussFarzad Bakhtiar9-Apr-00 21:56 
GeneralGetFieldValue() throws an exception Pin
Stefan20-Nov-99 5:25
Stefan20-Nov-99 5:25 
GeneralRE: GetFieldValue() throws an exception Pin
Member 40424-Nov-99 9:38
Member 40424-Nov-99 9:38 
GeneralRe: a step by step running Pin
goldmount19-Nov-04 3:25
goldmount19-Nov-04 3:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.