Partager via


WmiEventWatcherTask Constructeur

Définition

Initialise une nouvelle instance de la classe WmiEventWatcherTask.

public:
 WmiEventWatcherTask();
public WmiEventWatcherTask ();
Public Sub New ()

Exemples

L’exemple de code suivant crée un nouveau WmiEventWatcherTask à l’aide du constructeur.

WmiEventWatcherTask myTask = new WmiEventWatcherTask();  
Dim myTask As WmiEventWatcherTask =  New WmiEventWatcherTask()  

Remarques

L’exemple de code montre comment appeler le constructeur de tâche. Toutefois, dans la plupart des cas, vous allez créer la tâche en tant que membre d’un package. Pour plus d’informations sur la conversion de la tâche, consultez les remarques dans Add.

Package pkg = new Package();  
Executable exec1 = pkg.Executables.Add("STOCK:WmiEventWatcherTask");  
TaskHost th = exec1 as TaskHost;  
// You can cast the InnerObject of the TaskHost  
// to the specific class.  
// For the code samples, that task properties are accessed using  
// the Properties of the TaskHost.  
// WmiEventWatcherTask myTask = th.InnerObject as WmiEventWatcherTask;  
Dim pkg As Package =  New Package()   
Dim exec1 As Executable =  pkg.Executables.Add("STOCK:WmiEventWatcherTask")   
Dim th As TaskHost =  exec1 as TaskHost   
' You can cast the InnerObject of the TaskHost  
' to the specific class.  
' For the code samples, that task properties are accessed using  
' the Properties of the TaskHost.  
' Dim myTask As WmiEventWatcherTask =  th.InnerObject as WmiEventWatcherTask  

Les propriétés et les méthodes du fichier WmiEventWatcherTask sont disponibles à l’aide de la TaskHost variable. th

S’applique à