WmiEventWatcherTask Constructeur
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Initialise une nouvelle instance de la classe WmiEventWatcherTask.
public:
WmiEventWatcherTask();
public WmiEventWatcherTask();
Public Sub New ()
Exemples
L’exemple de code suivant en crée un nouveau WmiEventWatcherTask en utilisant le constructeur.
WmiEventWatcherTask myTask = new WmiEventWatcherTask();
Dim myTask As WmiEventWatcherTask = New WmiEventWatcherTask()
Remarques
L’exemple de code montre comment appeler le constructeur de tâches. Cependant, dans la plupart des cas, vous créerez la tâche en tant que membre d’un package. Pour plus d’informations sur la mise en place de la tâche, voir 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 méthodes de la WmiEventWatcherTask sont disponibles en utilisant la TaskHost variable, th.