Type | Description | |||
ID as Long | A long expression that indicates the identifier of the item that hosts an ActiveX control. | |||
Ev as OleEvent | An OleEvent object that contains information about the event. |
Use the Item property to access the menu's item by its identifier. Use the Add method to insert a popup menu that hosts an ActiveX control. Use the ControlID property to specify the control's identifier. Use the Create method to creates an ActiveX control inside a popup menu. The CloseOn property indicates when the popup menu is closed. Use the Refresh method to refresh the control after adding items to the menu. Use the Caption property to specify the caption of the item.
Syntax for OleEvent event, /NET version, on:
private void OleEvent(object sender,int ID,exontrol.EXMENULib.OleEvent Ev) { } Private Sub OleEvent(ByVal sender As System.Object,ByVal ID As Integer,ByVal Ev As exontrol.EXMENULib.OleEvent) Handles OleEvent End Sub |
private void OleEvent(object sender, AxEXMENULib._IMenuEvents_OleEventEvent e) { } void OnOleEvent(long ID,LPDISPATCH Ev) { } void __fastcall OleEvent(TObject *Sender,long ID,Exmenulib_tlb::IOleEvent *Ev) { } procedure OleEvent(ASender: TObject; ID : Integer;Ev : IOleEvent); begin end; procedure OleEvent(sender: System.Object; e: AxEXMENULib._IMenuEvents_OleEventEvent); begin end; begin event OleEvent(long ID,oleobject Ev) end event OleEvent Private Sub OleEvent(ByVal sender As System.Object, ByVal e As AxEXMENULib._IMenuEvents_OleEventEvent) Handles OleEvent End Sub Private Sub OleEvent(ByVal ID As Long,ByVal Ev As EXMENULibCtl.IOleEvent) End Sub Private Sub OleEvent(ByVal ID As Long,ByVal Ev As Object) End Sub LPARAMETERS ID,Ev PROCEDURE OnOleEvent(oExMenu,ID,Ev) RETURN |
<SCRIPT EVENT="OleEvent(ID,Ev)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function OleEvent(ID,Ev) End Function </SCRIPT> Procedure OnComOleEvent Integer llID Variant llEv Forward Send OnComOleEvent llID llEv End_Procedure METHOD OCX_OleEvent(ID,Ev) CLASS MainDialog RETURN NIL void onEvent_OleEvent(int _ID,COM _Ev) { } function OleEvent as v (ID as N,Ev as OLE::Exontrol.ExMenu.1::IOleEvent) end function function nativeObject_OleEvent(ID,Ev) return |
The following VB sample adds a MSCAL.Calendar control, and prints the event that inside ActiveX control fires:
Private Sub ExMenu1_OleEvent(ByVal ID As Long, ByVal Ev As EXMENULibCtl.IOleEvent) Debug.Print Ev.Name End Sub Private Sub Form_Load() With ExMenu1 With .Items.Add("Date", ItemTypeEnum.SubControl, 0).SubControl .CloseOn = exLButtonUp .ControlID = "MSCal.Calendar" .Create End With .Refresh End With End Sub
The following VB sample prints the events that an inside ActiveX control fires:
Private Sub ExMenu1_OleEvent(ByVal ID As Long, ByVal Ev As EXMENULibCtl.IOleEvent) With ExMenu1.Item(ID) Debug.Print (.Caption) End With With Ev Debug.Print .Name Dim i As Long For i = 0 To .CountParam - 1 With .Param(i) Debug.Print .Name & " = " & .Value End With Next End With End Sub
The following C++ sample prints the events that an inside ActiveX control fires:
#import <exmenu.dll> void OnOleEventExmenu1(long ID, LPDISPATCH Ev) { EXMENULib::IOleEventPtr spEvent( Ev ); OutputDebugString( spEvent->GetName() ); for ( long i = 0; i < spEvent->CountParam; i++ ) { EXMENULib::IOleEventParamPtr spParam = NULL; spEvent->get_Param( COleVariant( i ), &spParam ); CString strOutput; strOutput.Format( "%s = %s", spParam->Name.operator const char *(), V2S( &spParam->Value ) ); OutputDebugString( strOutput ); } }
The C++ sample requires #import <exmenu.dll> to import definitions for OleEvent and OleEvenParam objects. It generates the EXMENULib namespace that includes all objects for the ExMenu component.
The V2S function converts a VARIANT value to a string expression:
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; }
The following VB.NET sample prints the events that an inside ActiveX control fires:
Private Sub AxExMenu1_OleEvent(ByVal sender As Object, ByVal e As AxEXMENULib._IMenuEvents_OleEventEvent) Handles AxExMenu1.OleEvent With AxExMenu1.item(e.iD) Debug.Print(.Caption) End With With e.ev Debug.WriteLine(.Name()) Dim i As Integer For i = 0 To .CountParam - 1 With .Param(i) Debug.WriteLine(.Name + " = " + .Value.ToString()) End With Next End With End Sub
The following C# sample prints the events that an inside ActiveX control fires:
private void axExMenu1_OleEvent(object sender, AxEXMENULib._IMenuEvents_OleEventEvent e) { System.Diagnostics.Debug.WriteLine(axExMenu1[e.iD].Caption); System.Diagnostics.Debug.WriteLine(e.ev.Name); for (int i = 0; i < e.ev.CountParam; i++) { EXMENULib.OleEventParam param = e.ev[i]; System.Diagnostics.Debug.WriteLine( param.Name + " = " + param.Value.ToString()); } }
The following VFP sample prints the events that an inside ActiveX control fires:
*** ActiveX Control Event *** LPARAMETERS id, ev With thisform.ExMenu1.Item(ID) wait window nowait (.Caption) EndWith With Ev wait window nowait .Name local i For i = 0 To .CountParam - 1 With .Param(i) wait window nowait .Name && + " = " + Str(.Value) EndWith Next EndWith