Re: how to add an event handler for a dynamically created ActiveX cont
"titanico" <titanico@discussions.microsoft.com> wrote in message
news:479C5A9B-935A-44C6-9ED1-51B71FD37AD0@microsoft.com
I create some ActiveX Sliders (with CAxWindow) at run-time.
Now i want to add, receive and handle a event (e.g. OnPositionChanged
from _IExSliderCtrlEvents) for each of this Sliders.
Indeed they have a fix ID-range, but as i do not know the amount of
Sliders (can vary from 1 to 20), i can not use the IDispEventImpl<ID,
CLASS > and SINK_ENTRY stuff.
Have a separate class derived from IDispEventImpl once (with any ID),
and write its sink map under assumption that it would sink events from
exactly one control. At run-time, your main class can create several
instances of this sink object (presumably one for each control) and
advise each sink to its control using DispEventAdvise method of
IDispEventImpl.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925