Board index » cppbuilder » component in bds2006

component in bds2006


2006-07-26 09:28:09 PM
cppbuilder95
Id like to write a component derived from TCommonDialog in BDS2006 C++.
Choosing Component/New VLC Component
Choosing TCommonDialog
Add to dclusr project.
Compile an get error Messages:
E2352 and E2353
 
 

Re:component in bds2006

The reason is, that TCommonDialog is an abstract calss. Execute() has to be
overwritten.
But how?
If i write a function named "virtual bool Execute(HWND *ParentWnd)"
i got the same errors "instance of abstract class TmyClass can not be
created"
"Manfred" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote

Id like to write a component derived from TCommonDialog in BDS2006 C++.

Choosing Component/New VLC Component
Choosing TCommonDialog
Add to dclusr project.
Compile an get error Messages:
E2352 and E2353

 

Re:component in bds2006

Manfred wrote:
Quote
The reason is, that TCommonDialog is an abstract calss. Execute() has to be
overwritten.
But how?
If i write a function named "virtual bool Execute(HWND *ParentWnd)"
i got the same errors "instance of abstract class TmyClass can not be
created"


Hi Manfred,
If you look closely at the TCommonDialog, in <Dialogs.hpp>, you will see
that one of the Execute functions has the next prototype.
virtual bool __fastcall Execute(HWND ParentWnd) = 0 /* overload */;
The "= 0" at the end means you have to override or overload it, not
overwrite, and overload it exactly the same. Without the "= 0" ofcourse,
and with a body.
So add the __fastcall and remove the asterix from the argument and
supply your cody within the function body. Or no code at all, whatever
suits your needs.
virtual bool __fastcall Execute(HWND ParentWnd);
Your derived class should then at least compile.
Success,
Wiljo.
 

{smallsort}

Re:component in bds2006

Im very surprised about the quick response.
Many thanks for your explanation. It works.
"Wiljo" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote
Manfred wrote:
>The reason is, that TCommonDialog is an abstract calss. Execute() has to
>be overwritten.
>But how?
>If i write a function named "virtual bool Execute(HWND *ParentWnd)"
>i got the same errors "instance of abstract class TmyClass can not be
>created"
>
>
Hi Manfred,

If you look closely at the TCommonDialog, in <Dialogs.hpp>, you will see
that one of the Execute functions has the next prototype.

virtual bool __fastcall Execute(HWND ParentWnd) = 0 /* overload */;

The "= 0" at the end means you have to override or overload it, not
overwrite, and overload it exactly the same. Without the "= 0" ofcourse,
and with a body.
So add the __fastcall and remove the asterix from the argument and supply
your cody within the function body. Or no code at all, whatever suits your
needs.

virtual bool __fastcall Execute(HWND ParentWnd);

Your derived class should then at least compile.

Success,

Wiljo.