windows 如何查看ocx文件的接口?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5321970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I see the interfaces of a ocx file?
提问by Sid Zhang
I want to see the interfaces of an ".ocx" file. Like this:
我想查看“.ocx”文件的接口。像这样:
But for some .ocx, I can only see 5 functions, Like this:
但是对于一些 .ocx,我只能看到 5 个函数,像这样:
The question is: How can I see the interfaces of these ocx file. I have try this:
问题是:如何才能看到这些ocx文件的接口。我试过这个:
A.
a) I want register it and see it in visual studio. But when I register it, an error appears "LoadLibrary(path:\filename.ocx) failed". Like this:
A.
a) 我想注册它并在 Visual Studio 中看到它。但是当我注册它时,出现错误“LoadLibrary(path:\filename.ocx) failed”。像这样:
b) Then I used 'Dependency Walker' open the ocx, found the file dependences no DLL files .
b) 然后我用'Dependency Walker'打开ocx,发现文件依赖没有DLL文件。
c) How can I register it?
c) 如何注册?
B. I use "Dll Export Viewer" and now I can see the function's name but still can not get the function's parameters. How can i get the parameters of a function?
B. 我使用“Dll Export Viewer”,现在可以看到函数的名称,但仍然无法获取函数的参数。如何获取函数的参数?
采纳答案by Marius Bancila
Did you try the OLE/COM Object Viewer? http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5233b70d-d9b2-4cb5-aeb6-45664be858b6&displaylang=en
您是否尝试过 OLE/COM 对象查看器?http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5233b70d-d9b2-4cb5-aeb6-45664be858b6&displaylang=en
回答by harper
The interface is described in the type library (TLB). Your DLL (OCX is a DLL) should contain the TLB in a TypeLibrary resource. You can extract this TLB and get the interface description. This job should also be done by OLE View.
该接口在类型库 (TLB) 中进行了描述。您的 DLL(OCX 是一个 DLL)应该在 TypeLibrary 资源中包含 TLB。您可以提取此 TLB 并获取接口描述。这项工作也应该由 OLE 视图来完成。
If your DLL does not contain a TLB and no TLB file is provided you won't get the interface description.
如果您的 DLL 不包含 TLB 并且没有提供 TLB 文件,您将无法获得接口描述。
Edit:Tools like "DLL Export Viewer" showed less information than OLE View. It's worth to use the tools provided by Microsoft.
编辑:像“DLL 导出查看器”这样的工具显示的信息比 OLE 视图少。值得使用微软提供的工具。
When you have the decorated names in your files screenshot, you get the function signatures with the "Microsoft (R) C++ Name Undecorator" (undname.exe)
当您在文件屏幕截图中有装饰名称时,您将获得带有“Microsoft (R) C++ Name Undecorator”(undname.exe) 的函数签名
回答by David Heffernan
Import the type library with the Type Library Importer.
导入与类型库类型库导入。
Since you are using C++, it's probably easiest to do this with #import
.
由于您使用的是 C++,因此使用#import
.
This Code Projectarticle gives step-by-step procedures.
这篇代码项目文章提供了分步过程。
回答by Simon Mourier
Long time ago, I used this tool called XRay: X-Ray Vision. It was quite simple to use and still works in Windows 7 I believe. But as other tools, it requires the DLL/OCX to embed a Type Library, or you need to find the corresponding one.
很久以前,我用过这个叫做 XRay 的工具:X-Ray Vision。它使用起来非常简单,我相信它仍然适用于 Windows 7。但是和其他工具一样,它需要DLL/OCX嵌入一个类型库,或者你需要找到对应的。