Exposing COM Interface

alaniscool

Senior member
Jul 30, 2000
254
0
0
If I already have an existing Windows .EXE, how could I expose some of its methods as a COM interface?
 

Ameesh

Lifer
Apr 3, 2001
23,686
1
0
implemnt i dispatch or go the i uknown/iqueryinterface way

you probably should get a book on com if you dont know what i am talking about.
 

alaniscool

Senior member
Jul 30, 2000
254
0
0
I know that if you started the project as an ATL project, then you could simply Create a new ATL object, and it'll auto-generate all of these IUNKNOWN/IDISPATCH stuff, however, the EXE wasn't created as an ATL project. Is there a way for me to still get vc++ 6.0 to autogenerate the stuff for me?
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Is there a way for me to still get vc++ 6.0 to autogenerate the stuff for me?

In short: no.

You can't simply take a PE executable and have it automatically generate a COM component out of it. There are many reasons why this is so... a few are noted:

1) Your executable probably doesn't export (__declspec(dllexport) or in your .def file) any functions, so it couldn't simply permute the routines in your program and generate the IDL necessary for COM, etc.

2) Even if the above were possible, you're probably not returning HRESULTs.

Do you have the source code to this other project?