访问使用C ++或C应用程序的COM接口 [英] Accessing an application's COM interface using C++ or C

查看:178
本文介绍了访问使用C ++或C应用程序的COM接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在回答问题,我怎么能(或找到更多信息)自动化某些功能无需用户干预,从使用C ++(或C):

In response to question, how can I (or find more information to) automate certain functionality without user intervention, from a C++ (or C) using:


  • ATL

  • 或自动code直接在C / C ++

问候

推荐答案

如果申请公开了一个类型库(与Microsoft Office应用程序做),那么你可以在它使用的#import关键字从Microsoft C ++。这将创建C ++包装由应用程序公开的COM接口。

If the application exposes a type library (and Microsoft Office applications do), then you can get at it from Microsoft C++ by using the #import keyword. This will create C++ wrappers for the COM interfaces exposed by the application.

类型库通常是.TLB文件,但它们经常嵌入在可执行文件的Win32资源。

Type libraries are often .TLB files, but they are regularly embedded as Win32 resources in executable files.

要找出是否申请公开其这样的功能,你可能需要咨询的特定应用程序的文档,因为发现(和理解)类型库是相当复杂的。

To find out if an application exposes its functionality in this way, you'll probably need to consult the documentation for the specific application, because discovering (and understanding) type libraries is quite complicated.

在Windows SDK包括一个工具,OLE / COM查看器,它可以显示在注册表中的COM对象类型库的信息,或从.TLB文件或资源。

The Windows SDK includes a tool, "OLE/COM Viewer" that can display typelibrary information for a COM object in the registry, or from a .TLB file or resource.

如果您想与应用程序打,VBScript中(或JScript)给你一个快速的方法进行实验。他们都能够消耗OLE自动化接口。

If you want to play with an application, VBScript (or JScript) give you a quick way to experiment. They're both capable of consuming OLE Automation interfaces.

这篇关于访问使用C ++或C应用程序的COM接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆