OLE 入门 - 什么是好的学习项目选择?
我怀疑我很快就会需要编写一个“集成”库,该库需要从 Java 调用 Windows 上的 OLE 对象。
我之前已经在 Windows 上完成了 Java 到 C/C++ 的集成(使用 C/C++ 和 JNI)——所以我对等式的这一部分并不陌生。
然而; 我想尝试围绕 OLE 对象编写一个 C/C++ 包装器,以便对项目的该部分进行测试。
所以,有一些问题:
我可以使用 VS C++ Express Edition 执行 OLE 操作吗? 我相信答案是,“是的,但是你没有 MFC,所以你不能调用 Microsoft OLE 对象(例如 Excel、Word 等)”
如果我关于 #1 的假设是正确的,我需要一个提供我可以调用的 OLE 对象的“测试”应用程序 - 对于好的做法有哪些建议?
I suspect that I will shortly have a need to write an "integration" library that will need to call an OLE object on Windows from Java.
I have done Java to C/C++ integration on windows before (using C/C++ and JNI) - so I'm not new to that part of the equation.
However; I'd like to try out writing a C/C++ wrapper around an OLE object to give that part of the project a test-spin.
So, some questions:
Can I do OLE with VS C++ Express Edition. I believe the answer is, "Yes, but you don't have MFC, so you can't call the Microsoft OLE Objects (e.g. Excel, Word, etc.)"
If my presumption about #1 is correct, I need a "test" application that provides an OLE object that I can call - what are suggestions for something that would be good practice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您可以使用 VC++ Express 执行 OLE,我建议安装 Windows Platform SDK。 您不需要 MFC 来使用 Office 应用程序。 使用 VC++ Express 2005,您可以安装旧版本的 Platform SDK 2003 R1,其中包括 ATL,它是 COM 功能的便捷包装器。 如果您无法安装它,您可以创建自己的包装,请参阅这篇更高级的文章 COM in Plain C .
提供 COM 对象的众所周知的应用程序是 Internet Explorer,也是 Windows Media Player,并且可以通过 COM 访问 Flash。
提供 COM 对象的众所周知的应用程序是 Internet
你也可以看看 Jacob “The JACOB Project: A JAva-COM Bridge”
你可以认为COM 是构建 OLE 功能的层。
Yes, you can do OLE with VC++ Express, I'd recommend to install Windows Platform SDK. You don't need MFC to use office applications. With VC++ Express 2005 you can install the older version of Platform SDK 2003 R1 which includes ATL, which are convenient wrappers around COM functionality. If you can't install it you can create you own wrappes see this more advanced article COM in Plain C .
A well know application which provides COM objects is Internet Explorer, also Windows Media Player, and Flash can be accessed by COM.
Also you can take a look at Jacob "The JACOB Project: A JAva-COM Bridge"
You can think that COM is the layer in which OLE functionality is built.
目前尚不清楚您指的是实际的 OLE(具有就地编辑功能的嵌入/链接文档)还是只是自动化(调用 Office 应用程序的编程模型)。
无论哪种方式,您都可以使用 Visual C++ Express Edition 执行 OLE,只是无法获得 MFC 的(有点可疑的)优势来帮助您执行此操作。 您也不会使用 ATL,它不像 MFC 那么糟糕,但也没有那么好。
OLE 的问题在于,除非您有某种库作为您工作的基础,否则您将不得不编写大量样板代码。 您需要参考一些古代文本。
至于测试应用程序,为什么不使用Word、Excel等呢?
It's not clear whether you mean actual OLE (embedded/linked documents with in-place editing) or just Automation (calling into the programming models of Office applications).
Either way, you can do OLE with Visual C++ Express Edition, you just won't have the (somewhat dubious) benefits of MFC to help you do it. You won't have ATL either, which is not as bad as MFC, but neither is that great.
The problem with OLE is that, unless you have some kind of library to base your work on, you will have to crank out a lot of boilerplate code. You'd need to refer to some ancient texts.
As for a test application, why not use Word, Excel, etc.?