If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

ATL project (simple COM server)

I created simple COM out-of-proc EXE server (CLSCTX_LOCAL_SERVER) using ATL project in Microsoft Visual Studio 2008. Also I added my class and my interface to the project. I don't need Automation, so I don't want to derive from IDispatch and my interface is not dual interface. Here is CMyClass definition in the header file:

MYSTRUCT structure (and PMYSTRUCT pointer) is defined in project's *.idl file and resides in MyServer_i.h header file generated by MIDL compiler. CreateMyObject method is defined in correspondent *.cpp file of CMyClass.
Well, this project is compiled and linked perfectly without any problems.
My problem is that when I try to call CoCreateInstance of CMyClass COM object from different client appication and requesting IMyClass interface it fails to do so (returns NULL pointer). When I open OleView.exe application It shows My class in registered objects, but there is no IMyClass interface in the object. The interesting thing is that when I look to the type library (again using OleView) I can see IMyClass interface, CMyClass object and MYSTRUCT structure. I'm thinking might be COM_INTERFACE_ENTRY(IMyClass) macro somehow doesn't put IMyClass interface into CMyClass object interface MAP.

BTW if I use dual interface (IMyClass is derived from IDispatch using IDuspatchImpl) all is working (I can get IMyClass interface from client application). But I don't need to support IDispatch.
Any ideas?

Re: ATL project (simple COM server)

Thank You for your answer.
Actually I don't want to implement my own marshaling.
I want to use standard marshaling.
As I know for dual interfaces (the interfaces inherited from IDispatch)
oleaut32.dll proxy/stub dll handles all burden related to marshaling.
Is it possible to use oleaut32.dll proxy/stub for non-dual (Custom) interfaces?
Or might be there is other standard proxy/stub DLL for non-dual (Custom) interfaces?
I can remove PMYSTRUCT custom-defined structure pointer from CreateMyObject method of IMyClass interface and use only Automation compatible types such as VARIANT, SAFEARRAY and so on.
The thing I need is not inherit from IDispatch (I really don't need it) and use some standard marshaling.
Is it possible?

Re: ATL project (simple COM server)

It seems the problem is solved. Actually it was not a problem.
ATL COM Wizard made a proxy/stub DLL project, I just needed to build the DLL and register it.
And now I'm wondering why ATL COM Wizard does not properly set the project dependences, so after I build my basic COM Server project with DEBUG configuration, its project/stub DLL project also builds and registers proxy/stub DLL? I suppose this is intuitive...

Re: ATL project (simple COM server)

Originally Posted by Miran

And now I'm wondering why ATL COM Wizard does not properly set the project dependences, so after I build my basic COM Server project with DEBUG configuration, its project/stub DLL project also builds and registers proxy/stub DLL? I suppose this is intuitive...

The reason is that not everyone wants/needs a proxy. Glad to hear that you got it solved.

Re: ATL project (simple COM server)

Where is your interface source code? I am pretty sure your interface is automation compatible and I think you should use the oleautomation attribute for your interface. This will enable the universal marshaling for your interface and then you really don't need the PS project and ps dll.

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.