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

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


Communication between OCX controls.

Sridhar Rao Chedalla -- C.Sridhar@blr.sni.de
Tuesday, January 07, 1997

Hello,

	Environment : Visual C++ 4.2-flat, WinNT 4.0

	Is it possible to communicate between two OCX controls with in the same
container using IDispatch interface. If yes are there any samples in the
net available for that. I do not have MSDN. I found lot of samples with
communication between container and OCX control but not between two OCX
controls directly. If two OCX controls cannot communicate directly then
what is the alternative. I guess ConnectionPoints are the solution. Am I
true. Where can I get detailed information about connection points.


Thanks in Advance.

C.Sridhar



Sridhar Rao Chedalla -- C.Sridhar@blr.sni.de
Wednesday, January 08, 1997

Hello,

        Environment : Visual C++ 4.2-flat, WinNT 4.0

        Is it possible to communicate between two OCX controls with in
the same
container using IDispatch interface. If yes are there any samples in the
net available for that. I do not have MSDN. I found lot of samples with
communication between container and OCX control but not between two OCX
controls directly. If two OCX controls cannot communicate directly then
what is the alternative. I guess ConnectionPoints are the solution. Am I
true. Where can I get detailed information about connection points.


Thanks in Advance.

C.Sridhar



Giles R. Chamberlin -- GRC@langley.softwright.co.uk
Tuesday, January 07, 1997


> Is it possible to communicate between two OCX controls with in
> the same container using IDispatch interface.
Yes, as long as you know what methods are present.  Given an IUnknown to   
the other OCX, just query interface for the IDispatch.  If you have   
control over both IDispatch's you could add a method to notify the other   
control of your IDispatch.

Whilst this works, its a bit non standard as you're duplicating the   
functionality of IConnectionPoint.  In the long run, you'll probably be   
better off using that and doing things "properly".

To get the IUnknown - call the container's IOleContainer::EnumObjects to   
get an IEnumUnknown and iterate through that until you find the control   
that you want.

To get the IOleContainer, call your controls IOleObject::GetClientSite ->   
IOleClientSite then call IOleClientSite::GetContainer -> IOleContainer.

>If two OCX controls cannot communicate directly then what is the   
alternative. I guess >ConnectionPoints are the solution. Am I true.
Connection points are simply a way for an object to describe what   
interfaces it would like to find on another object, and then to be   
advised of that interface in a consistent manner.  You still have direct   
communication between two objects.

>Where can I get detailed information about connection points.
I strongly recommend buying "Inside OLE, 2nd edition", Kraig   
Brockschmidt, Microsoft Press, ISBN 1-55615-843-2 if you're going to be   
doing much detailed OLE programming.  It costs about US$ 50.

Giles Chamberlin
Softwright
grc@langley.softwright.co.uk  



Ratnakar Dev -- rdev@inacom.com
Thursday, January 09, 1997



----------------------[Reply - Original Message]----------------------

Sent by:Sridhar Rao Chedalla 
 Hello,

        Environment : Visual C++ 4.2-flat, WinNT 4.0

        Is it possible to communicate between two OCX controls with in
the same

=====================================================================

You might want to take a look at 

MFC/COM Objects 3:
Objects That Talk Back
by Nigel Thomson

http://www.microsoft.com/oledev/olecom/house3.htm

Regards,
R Dev




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