Run-Time Function: Assigns user-written event handlers to ActiveX controls in a dialog box.
Module: USE DFLOGM
Syntax
Results:
The result is of type INTEGER(4). The result is an HRESULT describing the status of the operation.
When the ActiveX control event occurs, the handler associated with the event is called. You call DLGSETCTRLEVENTHANDLER to specify the handler to be called.
The events supported by an ActiveX control and the interfaces of the handlers are determined by the ActiveX control.
You can find this information in one of the following ways:
The handler that you define in your application must have the interface that the ActiveX control expects, including calling convention and parameter passing mechanisms. Otherwise, your application will likely crash in unexpected ways because of the application's stack getting corrupted.
Note that an object is always the first parameter in an event handler. This object value is a pointer to the control's source (event) interface, not the IDispatch pointer of the control. You can use DLGGET with the DLG_IDISPATCH index to retrieve the control's IDispatch pointer.
For more information, see Using ActiveX Controls in the Programmer's Guide.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
See Also: DLGINIT, DLGGET, DLGMODAL, DLGMODELESS, DLGSETSUB
Example
ret = DlgSetCtrlEventHandler( &
dlg, &
IDC_ACTIVEMOVIECONTROL1, & ! Identifies the control
ReadyStateChange, & ! Name of the event handling routine
-609, & ! Member id of the ActiveMovie's
& ! control ReadyStateChange event.
IID_DActiveMovieEvents2 ) ! Identifer of the source (event)
! interface.