Retrieves or sets the value of the event's parameter.
Type | Description | |||
Variant | A variant value that indicates the value of the event's parameter. |
Use the Value property to specify the value of the parameter. Use the ID property to specify a specified even by its identifier. Use the ToString property to display information about fired event such us name, parameters, types and values. Use the CountParam property to count the parameters of an OLE event. Use the Param property to get the event's parameter.
The following VB sample enumerates the arguments of an OLE event when OLEEvent is fired.
Private Sub StatusBar1_OleEvent(ByVal Panel As EXSTATUSBARLibCtl.IPanel, ByVal Ev As EXSTATUSBARLibCtl.IOleEvent) Debug.Print "Event name:" & Ev.Name If (Ev.CountParam = 0) Then Debug.Print "The event has no arguments." Else Debug.Print "The event has the following arguments:" Dim i As Long For i = 0 To Ev.CountParam - 1 Debug.Print Ev(i).Name; " = " & Ev(i).Value Next End If End Sub
The following VC sample displays the events that an inner ActiveX control fires:
#import "C:\\WINNT\\SYSTEM32\\ExStatusBar.dll" using namespace EXSTATUSBARLib; static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") ) { if ( pv ) { if ( pv->vt == VT_ERROR ) return szDefault; COleVariant vt; vt.ChangeType( VT_BSTR, pv ); return V_BSTR( &vt ); } return szDefault; } void OnOleEventStatusbar1(LPDISPATCH Panel, LPDISPATCH Ev) { EXSTATUSBARLib::IOleEventPtr spEvent( Ev ); CString strOutput; strOutput.Format( "Event's name: %s\n", spEvent->Name.operator const char *() ); OutputDebugString( strOutput ); if ( spEvent->CountParam == 0 ) OutputDebugString( "The event has no parameters." ); else { for ( long i = 0; i < spEvent->CountParam; i++ ) { EXSTATUSBARLib::IOleEventParamPtr spParam = spEvent->GetParam( COleVariant( i ) ); strOutput.Format( "Name: %s, Value: %s\n", spParam->Name.operator const char *(), V2S( &spParam->Value ) ); OutputDebugString( strOutput ); } } OutputDebugString( "" ); }
The #import clause is required to get the wrapper classes for IOleEvent and IOleEventParam objects, that are not defined by the MFC class wizard. The same #import statement defines the EXSTATUSBARLib namespace that include all objects and types of the control's TypeLibrary. In case your exstatusBar.dll library is located to another place than the system folder or well known path, the path to the library should be provided, in order to let the VC finds the type library.
The following VB.NET sample displays the events that an inner ActiveX control fires:
Private Sub AxStatusBar1_OleEvent(ByVal sender As System.Object, ByVal e As AxEXSTATUSBARLib._IStatusBarEvents_OleEventEvent) Handles AxStatusBar1.OleEvent Debug.WriteLine("Event's name: " & e.ev.Name) Dim i As Long For i = 0 To e.ev.CountParam - 1 Dim eP As EXSTATUSBARLib.OleEventParam eP = e.ev(i) Debug.WriteLine("Name: " & e.ev.Name & " Value: " & eP.Value) Next End Sub
The following C# sample displays the events that an inner ActiveX control fires:
private void axStatusBar1_OleEvent(object sender, AxEXSTATUSBARLib._IStatusBarEvents_OleEventEvent e) { System.Diagnostics.Debug.WriteLine("Event's name: " + e.ev.Name.ToString()); for (int i = 0; i < e.ev.CountParam; i++) { EXSTATUSBARLib.IOleEventParam evP = e.ev[i]; System.Diagnostics.Debug.WriteLine("Name: " + evP.Name.ToString() + ", Value: " + evP.Value.ToString()); } }
The following VFP sample displays the events that an inner ActiveX control fires:
*** ActiveX Control Event *** LPARAMETERS panel, ev local s s = "Event's name: " + ev.Name for i = 0 to ev.CountParam - 1 s = s + "Name: " + ev.Param(i).Name + " ,Value: " + Str(ev.Param(i).Value) endfor wait window nowait s