Retrieves an OleEventParam object given either the index of the parameter, or its name.
Type | Description | |||
item as Variant | A long expression that indicates the argument's index or a a string expression that indicates the argument's name. | |||
OleEventParam |
An OleEventParam object that contains the name and the value for the argument. |
Private Sub Record1_UserEditorOleEvent(ByVal Object As Object, ByVal Ev As EXRECORDLibCtl.IOleEvent, ByVal Ed As EXRECORDLibCtl.IEditor) On Error Resume Next Debug.Print "Event name: " & Ev.Name If (Ev.CountParam = 0) Then Debug.Print vbTab & "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 vbTab & Ev(i).Name; " = " & Ev(i).Value Next End If End Sub
The following VC sample enumerates the arguments of an OLE event:
void OnUserEditorOleEventRecord1(LPDISPATCH Object, LPDISPATCH Ev, LPDISPATCH Ed) { EXRECORDLib::IOleEventPtr spEvent = Ev; CString strOutput = "Event name: "; strOutput += spEvent->Name; strOutput += "\r\n"; if ( spEvent->CountParam == 0 ) { strOutput += "\tThe event has no arguments."; } else { strOutput += "\tThe event has no arguments.\r\n"; for ( long i = 0; i < spEvent->CountParam; i++ ) { strOutput += spEvent->GetParam( v(i) )->Name; strOutput += " = "; strOutput += V2S( &spEvent->GetParam( v(i) )->Value); strOutput += "\r\n"; } } m_output = strOutput; UpdateData( FALSE ); }
The #import "c:\winnt\system32\ExRecord.dll"
generates the EXRECORDLib namespace that includes definitions for OleEvent and
OleEventParam objects.