Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Question about classes in ATL. Little confused.

I'm trying to port some code from Delphi to C++ to compile it as a com object.

Now I'm not that experience with C++ as a whole so this is probably a fairly easy answer but I'm stuck.

Basicly what I am trying to do is create 2 controls. They are both within the one project.

The first one's class name is: CSCIVBX

The second one's class name is: CSCIHighlighter.

(It's actually a start on an ATL ActiveX wrapper for scintilla).

The intention was to have the CSCIHighlighter be a one instance kind of control. You initialize it, load the files, use it to change options and settings, etc. and it will then have a couple functions called that will set the neccisary properties to the CSCIVBX class.

The problem I'm having is this. I added a method to CSCIHighlighters called

SetStyles(CSCIVBX Scintilla, BSTR LangName)

I was thinking you could define a variable as a class. What I end up getting is this:
C:\Documents and Settings\Stewart\Desktop\SCIVB\SCIHighlighter.h(87) : error C2259: 'CSCIVBX' : cannot instantiate abstract class due to following members:
C:\Documents and Settings\Stewart\Desktop\SCIVB\SCIVBX.h(16) : see declaration of 'CSCIVBX'
C:\Documents and Settings\Stewart\Desktop\SCIVB\SCIHighlighter.h(87) : warning C4259: 'long __stdcall CSCIVBX::QueryInterface(const struct _GUID &,void ** )' : pure virtual function was not defined
C:\Documents and Settings\Stewart\Desktop\SCIVB\SCIVBX.h(68) : see declaration of 'QueryInterface'
C:\Documents and Settings\Stewart\Desktop\SCIVB\SCIHighlighter.h(87) : warning C4259: 'unsigned long __stdcall CSCIVBX::AddRef(void)' : pure virtual function was not defined
C:\Documents and Settings\Stewart\Desktop\SCIVB\SCIVBX.h(68) : see declaration of 'AddRef'
===================================================================

So as it stands I'm stuck on how I would do this. I basicly need a variable
that is defined as the CSCIVBX class so it can make calls to it's publicly exposed methods.

Any help at all is greatly appreciated. Thanks a lot :)

Stewart
[2288 byte] By [sobert81] at [2007-11-11 8:15:30]
# 1 Re: Question about classes in ATL. Little confused.
Well, there are probably many other errors in your code but what the compiler is saying is that you can't pass an abstract class by value. In other words, your member function must use references or pointers:

void virtual SetStyles(CSCIVBX & Scintilla, BSTR &LangName);
Danny at 2007-11-11 21:01:28 >