vb event set handling.. 
Author Message
 vb event set handling..

Does VB use IDispatch or dispinterfaces for handling event sets? If it uses
IDispatch, has anyone solved the problem of letting an object add/change
event sets during runtime?

TIA, Jason



Mon, 01 Jul 2002 03:00:00 GMT  
 vb event set handling..
Jason
IDispatch and dispinterface are the same. VB uses IDispatch for events. You
cannot add or change events a runtime. This is because you must early bind
to an object to get what events it has. VB will create an event sink
through the COM interfaces IConnection Point and IConnectionPointContainer.
to hook up the client's event sink to the object's outbound interface. We
do this by looking at the typlib for outbound method calls. Because the
object is a COM component you should not change the interface once the
component is published. Also COM components are compiled so if you wanted
to change the interface you would have to re-compile the object.

Thanks
Brian Combs
Microsoft Developer Support for Visual Basic



Fri, 05 Jul 2002 03:00:00 GMT  
 vb event set handling..
I just finished reading Inside OLE, and it I gathered from that that
any object should be able to at run time create a sink and attach
it to an event source, of course done with the help of the
IProvideClassInfo.
Errors that I get trying to fiddle with things are like "Object doesn't
support
Automation events." Is it not true that automation is done entirely through
the IDispatch interface and automation events will to( chapter 24). So I may
be confused
but in automation a call to IConnectionPoint will return an IDispatch
pointer
and a string as to which function to call. With VB supposedly only
supporting
automation I think it should be possible to create a IDispatch based sink at
runtime and hook it to whatever object has such an event set. If you have
the time to answer one other question on this line. As I was staring at the
object browser it looked like the event set was the same for all intrinsic
controls.
Is this true?

TIA, Jason

Quote:

>Jason
>IDispatch and dispinterface are the same. VB uses IDispatch for events. You
>cannot add or change events a runtime. This is because you must early bind
>to an object to get what events it has. VB will create an event sink
>through the COM interfaces IConnection Point and IConnectionPointContainer.
>to hook up the client's event sink to the object's outbound interface. We
>do this by looking at the typlib for outbound method calls. Because the
>object is a COM component you should not change the interface once the
>component is published. Also COM components are compiled so if you wanted
>to change the interface you would have to re-compile the object.

>Thanks
>Brian Combs
>Microsoft Developer Support for Visual Basic



Fri, 05 Jul 2002 03:00:00 GMT  
 vb event set handling..
Jason
VB can use IDispatch or VTables for automation. However for ActiveX
controls VB will always use IDispatch. For events to happen VB will ask the
object for it's outgoing interfaces. It will then allow you to write code
in the client that runs when the object calls this interface. An outgoing
interface indicates that the object is able to call methods on an interface
that it defines. The server object does not actually implement this
outgoing interface. It is, rather, a specification for the interface that
the client object must create in order to receive events. Because of this
the outgoing interface that the client uses must match the interface that
the server defined. This is why you must use early binding in VB to receive
events. Because we are early bound you and only receive events from objects
that match the interface information that we compiled into the client.

The event set for intrinsic controls is not the same. Intrinsic controls
are private objects that live in the VB runtime. If you look at a TextBox
it will have a change event. However a CommandButton will not have this
event.  Many of the controls share the same events that the container gives
them. They will look like events that are part of the control but they are
part of the control extender.

Thanks
Brian Combs
Microsoft Developer Support for Visual Basic



Sun, 07 Jul 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. -~=###--WHAT IS THE DIFFERENCE BETWEEN HANDLED EVENTS AND UN-HANDLED EVENTS?---#=~-

2. ActiveX control to handle mouseover event handling?

3. A single event handling multiple events

4. handling multiple events with one event handler

5. handling multiple events with a single event handler

6. 'how vb handles security set by MS access

7. Event Handling in VB.Net WebForms

8. Event Handling Between Dynamically Loaded User Controls using vb.net

9. Handling key events in vb.net

10. VB Event Handling

11. Ax event handling...vb.net

12. Event-handling for MSAgent on VB.NET

 

 
Powered by phpBB® Forum Software