共用方式為


CommandEventsClass.BeforeExecute Event

Definition

Occurs before a command executes.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 virtual event EnvDTE::_dispCommandEvents_BeforeExecuteEventHandler ^ BeforeExecute;
public virtual event EnvDTE._dispCommandEvents_BeforeExecuteEventHandler BeforeExecute;
member this.BeforeExecute : EnvDTE._dispCommandEvents_BeforeExecuteEventHandler 
Public Overridable Custom Event BeforeExecute As _dispCommandEvents_BeforeExecuteEventHandler Implements BeforeExecute

Event Type

Implements

Examples

Public Sub CommandEvents_BeforeExecute(ByVal Guid As String, ByVal ID As Integer, ByVal CustomIn As Object, ByVal CustomOut As Object, ByRef CancelDefault As Boolean) Handles CommandEvents.BeforeExecute  
   MsgBox("test")  
End Sub  

Remarks

Before executing the function that is declared to be the implementation of a command, the BeforeExecute event occurs. Any number of listeners may be registered for the event. Each listener executes when the event occurs.

If a listener claims it has implemented the command, no other listener or function should try to implement the command. A listener claims to have implemented the command by returning true for the handled parameter. If a listener only performs some extra function that was not supposed to be performed, such as making a log entry that the command fired or perhaps incrementing a counter displayed somewhere, then the listener returns false for the handled parameter.

Use CommandEvents.BeforeExecute.

Applies to