Re: Making MFC application to expose COM interfaces
- From: Gangadhar NPK <npk.gangadharSPAMBUSTER@xxxxxxxxx>
- Date: Tue, 20 Dec 2005 21:01:21 +0530
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
.
- Follow-Ups:
- Re: Making MFC application to expose COM interfaces
- From: VivekR
- Re: Making MFC application to expose COM interfaces
- References:
- Making MFC application to expose COM interfaces
- From: VivekR
- Making MFC application to expose COM interfaces
- Prev by Date: Re: (Dialog) Windowsize
- Next by Date: Re: Windows Media Player ActiveX
- Previous by thread: Making MFC application to expose COM interfaces
- Next by thread: Re: Making MFC application to expose COM interfaces
- Index(es):
Relevant Pages
|