Syntax error converting IDL to C header

I am trying to get C header files for COM interfaces using the OLE / COM object viewer.

I am trying to save the type library as a header file in the object viewer, however, nothing happens after the cmd window starts blinking. I tried to save it as an IDL file and convert it to a header file using this command;

midl /out C:\temp /header EXCEL.h EXCEL.IDL

However, I get this error:

Microsoft (R) 32b/64b MIDL Compiler Version 7.00.0555
Copyright (c) Microsoft Corporation. All rights reserved.
64 bit Processing .\EXCEL.IDL
EXCEL.IDL
64 bit Processing C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\oaidl.idl

oaidl.idl
64 bit Processing C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\objidl.id
l
objidl.idl
64 bit Processing C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\unknwn.id
l
unknwn.idl
64 bit Processing C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\wtypes.id
l
wtypes.idl
64 bit Processing C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\basetsd.h

basetsd.h
64 bit Processing C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\guiddef.h

guiddef.h
.\EXCEL.IDL(17) : warning MIDL2015 : failed to load tlb in importlib: : VBE6EXT.
OLB
.\EXCEL.IDL(19) : warning MIDL2015 : failed to load tlb in importlib: : MSO.DLL
.\EXCEL.IDL(629) : error MIDL2025 : syntax error : expecting a type specificatio
n near "single"
.\EXCEL.IDL(629) : error MIDL2026 : cannot recover from earlier syntax errors; a
borting compilation

VBE6EXT.OLBthe file can be found in the file C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6, MSO.dllcan be found inC:\Program Files (x86)\Common Files\microsoft shared\OFFICE12

There are lines where warnings and errors occur:

  1. importlib("VBE6EXT.OLB");
  2. -
  3. importlib("MSO.DLL");

-

  1. HRESULT Item(
  2. [in] int Index,
  3. [out, retval] single* Val);

I suppose I need to tell midl where to find these two missing files, but I don't know how to do this.

Edit:

I updated the compiler command as follows:

midl /out C:\temp /header EXCEL.h /I "C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6;C:\Program Files (x86)\Common Files\microsoft shared\OFFICE12" EXCEL.IDL

, . midl single . - ?

+4

Source: https://habr.com/ru/post/1611179/


All Articles