PDA

Click to See Complete Forum and Search --> : ATL COM problem.... Plz help!


serhiy
Jan 4th, 2001, 02:09 AM
Goodday everybody...

Situation:
I created a project using ATL COM AppWizard. In the project, I created a ATL object called "VehicleDBManager".

Problem:
I want to creat a method for that ATL object which is:

HRESULT ReadVehicleTable([in] int nStatementId, [in] CString szParameterList, [in] _RecordsetPtr& pRecordset, [out] BOOL *ReturnVal)

but when I try to compile the project, the compiler prompts me the following error:

C:\Pims-Program\DBManager\DBManager.idl(18) : error MIDL2025 : syntax error : expecting a type specification near "CString"

Question:
Why I got this problem? Is it because I can't use CString data type, which is a MFC data type, when declaring the method? I try to change it to char* data type and it works, but the next error occur:

C:\Pims-Program\DBManager\DBManager.idl(18) : error MIDL2025 : syntax error : expecting a type specification near "_RecordsetPtr"

So, what should I do to solve this problem? Is it because of MFC or ...? Hopefully the solution won't have to be changing the data type. An explanation of why do this thing happen and solution will be most welcome.

Your help will be most appreciated...

P/S: By the way, I'm new to the world of COM and ATL.

serhiy
Jan 8th, 2001, 08:05 PM
no one really want to help?... :(

softwareguy74
Jan 11th, 2001, 01:48 PM
Did you enable support for MFC when you created the component with the ATL AppWiz?

serhiy
Jan 16th, 2001, 02:32 AM
yupe...

any help?

jovton
Jan 24th, 2001, 05:42 PM
Hang on in there! I hope I can be of some assistance.
I use ATL COM a lot. I had some huge problems with it.
I'll see what I can do.

samwise
Jan 30th, 2001, 01:38 PM
I'm using ATL COM too. I'm curious about the solution.

Samwise Galenorn
sam@galenorn.com

parksie
Jan 30th, 2001, 02:52 PM
You can't use CString with COM since it's a C++ class, rather than an intrinsic type. Replace it with const TCHAR*, and use it as any normal Unicode character array.

Nasty, but that's the way it is with COM. Think about it - VB has no equivalent to CString, but it DOES have a means of accessing a character array :)

serhiy
Jan 30th, 2001, 07:45 PM
What about the type '_RecordsetPtr'?
What can I replace it with?