vendredi 24 juin 2016

COM pointer name


I am trying to use a COM object in a C++ program. But I can't get the code to compile. It is something I have done many times before but with particular object I just can't get past the most basic step - declaring the variable! What I have done so far is: Import the DLL: #import "V8ZipSrv.dll" Tried to declare a variable of the object I want to use: _CZipSrvPtr pZipSrv; I am getting this error: error C2065: '__CZipSrv' : undeclared identifier The .TLH file the compiler generated looks like this: // Created by Microsoft (R) C/C++ Compiler Version 12.00.8964.0 (b856665e). // // debugV8ZipSrv.tlh // // C++ source equivalent of Win32 type library ....ComponentsDllV8ZipSrv.dll // compiler-generated file created 06/24/16 at 08:59:15 - DO NOT EDIT! #pragma once #pragma pack(push, 8) #include <comdef.h> namespace V8ZipSrv { // // Forward references and typedefs // struct __declspec(uuid("5951803c-9b0d-41e9-9d43-d20cd32eb167")) /* dual interface */ _CZipSrv; struct /* coclass */ CZipSrv; struct __declspec(uuid("ddb85661-5edc-4f42-8b80-d78d4e471cf9")) /* dispinterface */ __CZipSrv; // // Smart pointer typedef declarations // _COM_SMARTPTR_TYPEDEF(_CZipSrv, __uuidof(_CZipSrv)); _COM_SMARTPTR_TYPEDEF(__CZipSrv, __uuidof(IDispatch)); // // Type library items // struct __declspec(uuid("5951803c-9b0d-41e9-9d43-d20cd32eb167")) _CZipSrv : IDispatch { // // Wrapper methods for error-handling // enum enUnzipRTC UnZIPFiles ( BSTR * szUnZIP, BSTR * szDestPath, BSTR * szFileSpec ); short ZIPFiles ( BSTR * szZIP, SAFEARRAY * * szItems ); _bstr_t GetZIPInfo ( BSTR * szZIP ); void PutOverwrite ( VARIANT_BOOL * _arg1 ); VARIANT_BOOL GetOverwrite ( ); // // Raw methods provided by interface // virtual HRESULT __stdcall raw_UnZIPFiles ( BSTR * szUnZIP, BSTR * szDestPath, BSTR * szFileSpec, enum enUnzipRTC * _arg4 ) = 0; virtual HRESULT __stdcall raw_ZIPFiles ( BSTR * szZIP, SAFEARRAY * * szItems, short * _arg3 ) = 0; virtual HRESULT __stdcall raw_GetZIPInfo ( BSTR * szZIP, BSTR * _arg2 ) = 0; virtual HRESULT __stdcall put_Overwrite ( VARIANT_BOOL * _arg1 ) = 0; virtual HRESULT __stdcall get_Overwrite ( VARIANT_BOOL * _arg1 ) = 0; }; struct __declspec(uuid("bf5c04a5-7960-476a-acfd-e1c9d40704ea")) CZipSrv; // [ default ] interface _CZipSrv // [ default, source ] dispinterface __CZipSrv struct __declspec(uuid("ddb85661-5edc-4f42-8b80-d78d4e471cf9")) __CZipSrv : IDispatch { // // Wrapper methods for error-handling // // Methods: HRESULT OnError ( short p1, short p2, _bstr_t sz1, _bstr_t sz2, short * rc ); }; enum enUnzipRTC { UE_OK = 0, UE_EOF = 2, UE_STRUCT = 3, UE_MEM1 = 4, UE_MEM2 = 5, UE_NOFILE = 9, UE_BORED = 11, UE_INDEX = 25, UE_OUTPUT = 28, UE_OPEN = 29, UE_BADCRC = 39, UE_ENCRYPT = 41, UE_UNKNOWN = 42, UE_NOVOL = 46, UE_CMDERR = 47, UE_CANCEL = 48, UE_SKIP = 49, UE_DISKFULL = 50 }; // // Wrapper method implementations // #include "debugV8ZipSrv.tli" } // namespace V8ZipSrv #pragma pack(pop)

Aucun commentaire:

Enregistrer un commentaire