4

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

I have tries to save type library as header file in object viewer, however, after a cmd window flashes, nothing happens. I have tried to save it as IDL file and convert to header file myself using this command;

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

However, I am getting 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.OLB file can be found in C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6, MSO.dll file can be found at C:\Program Files (x86)\Common Files\microsoft shared\OFFICE12

There are the lines that warnings and errors happen:

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

--

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

My guess is that I need to tell midl to where to find those two missing files, but I don't know how to do that.

Edit:

I have updated the compiler command like this:

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

It fixes the failed to load warnings but syntax error still persists. midl doesnt recognize single as a type. Am I missing something here?

yasar
  • 13,158
  • 28
  • 95
  • 160
  • try to add "C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6" and "C:\Program Files (x86)\Common Files\microsoft shared\OFFICE12" to the path$ environment – milevyo Oct 11 '15 at 14:23

0 Answers0