-
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.
-
no one really want to help?... :(
-
Did you enable support for MFC when you created the component with the ATL AppWiz?
-
-
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.
-
Me Too
I'm using ATL COM too. I'm curious about the solution.
Samwise Galenorn
[email protected]
-
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 :)
-
What about the type '_RecordsetPtr'?
What can I replace it with?