15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


MFC And COM/OLE Threading

Steven Binney -- sbinney@waters.com
Friday, April 19, 1996

VC++4.1/NT 4.0 Beta

 Is it possible implement an OLE multi-threaded apartment model server =
under MFC??

I am developing a server with a large number of method and would like to =
take advantage of App and Class Wizards Automation support ( =
particularly in generating IDL/ODL).  The servers will be accessed by =
several clients which are either VB of MFC apps. It does not seem likely =
that VC++/MFC 4.x will support this.  Any help / suggestions would be =
greatly appreciated.

My server needs to be multi-threaded and must also act as a client.

							Steve Binney





Kevin Gilpin/Trilogy
Monday, April 22, 1996

Check out CoMarshalInterThreadInterfaceInStream and it's unmarshaling 
counterpart. These COM API functions allow you to easily pass an interface 
between threads. The general procecedure would look like:
You get a call into your (MFC-generated) Automation method, one of the 
parameters of which will presumably be the interface pointer to the client
Marshal the client's interface pointer into a stream using the above API
Begin a new thread, passing the LPSTREAM and any other relevant information 
through the pParam argument of AfxBeginThread
In the pfnThreadProc which you call, you can then unmarshal the interface from 
the stream and use it freely

So the marshaling stuff is not provided by MFC, but rather by the COM API. You 
can still use all the MFC support for Automation (and other) interfaces, though.

On 04/19/96 at 07:12 AM, sbinney @ waters.com (Steven Binney) @ SMTP wrote: 

VC++4.1/NT 4.0 Beta

 Is it possible implement an OLE multi-threaded apartment model server under 
MFC??

I am developing a server with a large number of method and would like to take 
advantage of App and Class Wizards Automation support ( particularly in 
generating IDL/ODL).  The servers will be accessed by several clients which are 
either VB of MFC apps. It does not seem likely that VC++/MFC 4.x will support 
this.  Any help / suggestions would be greatly appreciated.

My server needs to be multi-threaded and must also act as a client.

       Steve Binney





| Вернуться в корень Архива |