views:

223

answers:

3

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:

  1. 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.)"

  2. 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?

+1  A: 

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.?

Daniel Earwicker
+1  A: 
  1. 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 .

  2. 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.

Ismael
I'd +3 your reference to Jacob if I could...thanks!
Jared
A: 

Some knowledge background here OLE Automation Protocol Specification

lsalamon