我正在尝试使用OLE / COM对象查看器获取COM接口的C头文件。
我试图将类型库保存为对象查看器中的头文件,但是,在cmd窗口闪烁后,没有任何反应。我试图将其保存为IDL文件并使用此命令自行转换为头文件;
midl /out C:\temp /header EXCEL.h EXCEL.IDL
但是,我收到此错误:
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
文件位于C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6
,MSO.dll
文件位于C:\Program Files (x86)\Common Files\microsoft shared\OFFICE12
有警告和错误发生的行:
importlib("VBE6EXT.OLB");
importlib("MSO.DLL");
-
HRESULT Item(
[in] int Index,
[out, retval] single* Val);
我的猜测是我需要告诉midl在哪里找到这两个丢失的文件,但我不知道该怎么做。
编辑:
我已经像这样更新了编译器命令:
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并不认为单身是一种类型。我在这里错过了什么吗?