Re: Making MFC application to expose COM interfaces

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



IDispatch interfaces help one to use the interfaces from any automation-aware environment. Why do you think that this is not good enough for your application.
One way you can take a crack at this is to create the set of interfaces that you want, derive them from IDispatch. Provide ProgIds for the interfaces. Create a .reg file so that you can register the IID and ProgIDs. IIRC, when you create a MFC COM application, the appwizard creates a file which creates these (I think in the DllRegisterServer). You can steal that from a simple sample application.


hth

VivekR wrote:
Hi

Same topic posted in ATL group also. Please bear with me if you are
listening both groups.

My project is a MFC multidoc application.
It has been there for a few years, and now there is a need that this
application must expose COM interfaces to perform the operations that
can be performed from the UI and more. For example, from the UI, if we
can create a file or save a file, then the application must expose an
interface say IFile amongst the other interfaces that it exposes, to do
the same operations. Currently the application does not have any COM
stuff except AfxOleInit calls, nothing more than that.

The client [that is going to be a COM OutOfProc Server] must be able to
CoCreate the object exposed by the MFC application and then start using
it.

I felt that the creating a MFC class [a CCmdTarget derived class with
the help of the wizard] with automation support was not good enough to
solve this problem since it was only dispatch interface type and also i
faced problems queryinterfacing the interfaces which i could not figure
out.

I feel that there must be an ATL COM object inside this MFC application
that must be born as soon as the appplication starts either by
1. cocreateinstance called by the client
2. invoking the mfc application [initinstance] from explorer.

It must implement the interfaces that this MFC application is going to
expose, and take care of performing the operations working in
conjunction with the code already in place.

How do i register the guids that i create inside this MFC application
[any API] ?
Please suggest if this is the correct way or is there any other better
way.
Please suggest me how do i proceed in exposing interfaces from this MFC
application ?

Any help appreciated

Thanks & Regards
Vivek Ragunathan

.



Relevant Pages

  • Making MFC application to expose COM interfaces
    ... My project is a MFC multidoc application. ... application must expose COM interfaces to perform the operations that ... interface say IFile amongst the other interfaces that it exposes, ... faced problems queryinterfacing the interfaces which i could not figure ...
    (microsoft.public.vc.atl)
  • Making MFC application to expose COM interfaces
    ... Same topic posted in ATL group also. ... My project is a MFC multidoc application. ... application must expose COM interfaces to perform the operations that ... interface say IFile amongst the other interfaces that it exposes, ...
    (microsoft.public.vc.mfc)
  • Re: Making MFC application to expose COM interfaces
    ... > So what you mean to say is that if the MFC application, ... > Server since it is going to expose interfaces, ... > I double click the MFC Server from explorer. ...
    (microsoft.public.vc.atl)
  • Re: Input on graphic libraires
    ... > MFC - I am very familiar with MFC and I know it advantages well. ... > wxWindows - I just discovered this. ... building - libglade, for example, allows you to write your interfaces as ... d dot neary at phenix dot fr ...
    (comp.programming)
  • Registering a CLSID in MFC application
    ... My project is a MFC multidoc application. ... interfaces so that the application can cater the needs of the clients ... Where I should and what code must i add to register it. ...
    (microsoft.public.vc.mfc)