Results 1 to 8 of 8

Thread: ATL COM problem.... Plz help!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130
    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.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130

    Unhappy

    no one really want to help?...

  3. #3
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Did you enable support for MFC when you created the component with the ATL AppWiz?

    Visual Studio 2010

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130
    yupe...

    any help?

  5. #5
    Hyperactive Member jovton's Avatar
    Join Date
    Nov 2000
    Location
    South Africa
    Posts
    266

    Wink

    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.

    jovton

  6. #6
    Member
    Join Date
    Jan 2001
    Location
    Washington, USA
    Posts
    61

    Me Too

    I'm using ATL COM too. I'm curious about the solution.

    Samwise Galenorn
    [email protected]

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130
    What about the type '_RecordsetPtr'?
    What can I replace it with?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width