المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : problem importing a com file in c++



C++ Programming
04-03-2009, 03:42 PM
Hello everyone .

i am trying to import a COM file in vc++ project but the generated .tlh file from the com file seems to have an inherit errors , i successfully added #import directive in my stdafx.h file with the full phyiscal path to my com file then i included stdafx.h into my stdafx.cpp file , then i compile
the studio generates for me a .tlh file but that file seems to have errors in it .

the following code in the generated .tlh file has the problem


struct __declspec(uuid("92d8ec9e-550e-4525-a858-c8601ad50703"))
_VoiceNumbers : IDispatch
{
//
// Property data
//

__declspec(property(get=GetVoiceNumbers))
_CollectionPtr VoiceNumbers;

//
// Wrapper methods for error-handling
//

long Count ( );
HRESULT Delete (
long Index );
HRESULT Add (
struct _PhoneNumber * oAdd );
_PhoneNumberPtr Item (
long Index );
IUnknownPtr NewEnum ( );
_CollectionPtr GetVoiceNumbers ( );

//
// Raw methods provided by interface
//

virtual HRESULT __stdcall raw_Count (
/*[out,retval]*/ long * _arg1 ) = 0;
virtual HRESULT __stdcall raw_Delete (
/*[in]*/ long Index ) = 0;
virtual HRESULT __stdcall raw_Add (
/*[in]*/ struct _PhoneNumber * oAdd ) = 0;
virtual HRESULT __stdcall raw_Item (
/*[in]*/ long Index,
/*[out,retval]*/ struct _PhoneNumber * * _arg2 ) = 0;
virtual HRESULT __stdcall raw_NewEnum (
/*[out,retval]*/ struct IUnknown * * _arg1 ) = 0;
virtual HRESULT __stdcall get_VoiceNumbers (
/*[out,retval]*/ struct _Collection * * _arg1 ) = 0;
};


the bolded code part has the problem and the following errors are


Error 1 error C2146: syntax error : missing ';' before identifier 'VoiceNumbers' d:\hitech work\jniwork\testingrex\testingrex\debug\resumemirror.tlh 893 TestingRex
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int d:\hitech work\jniwork\testingrex\testingrex\debug\resumemirror.tlh 893 TestingRex
Error 3 error C2208: 'ResumeMirror::VoiceNumbers' : no members defined using this type d:\hitech work\jniwork\testingrex\testingrex\debug\resumemirror.tlh 893 TestingRex
Error 4 fatal error C1903: unable to recover from previous error(s); stopping compilation d:\hitech work\jniwork\testingrex\testingrex\debug\resumemirror.tlh 893 TestingRex



i am trying to make a wrapper for that com file to be able to call it from java using JNI technology .

each time i try to solve the errors , and compile again the studio generates for me another .tlh file as earlier one that has the same errors and i don't know what to do .

anyone has any solution for that please

Human knowledge belongs to the world.