Outils pour utilisateurs

Outils du site


fr:code:core:processhandle

Ceci est une ancienne révision du document !


ProcessHandle [En cours de Traduction Wismerheal][WSL]

Cet objet représente un processus en cours d’exécution.

Fonctions

ProcessHandle

Fonction de Construction.

Syntaxe

var myObject = new ProcessHandle();
var myObject = new ProcessHandle(otherProcessHandle);
var myObject = new ProcessHandle(processId);

Arguments

  1. otherProcessHandle - (ProcessHandle) autre "ProcessHandle" à copier
  2. processId - (entier) identifiant de processus pour gérer/contrôler celui-ci

Exceptions

  • (ParameterTypeError) type de paramètre incorrect
  • (ParameterCountError) nombre de paramètre incorrect

Example

Créer un "ProcessHandle" représentant un processus invalide.

var myObject = new ProcessHandle();

Créer un "ProcessHandle" représentant une copie d' otherProcessHandle.

var myObject = new ProcessHandle(otherProcessHandle);

Créer un "ProcessHandleé lié au processus disposant de l'identifiant (id) 1337.

var myObject = new ProcessHandle(1337);

Méthodes

clone

Renvoie une copie de ce "ProcessHandle".

Syntax

myObject.clone();

Renvoie

  • (ProcessHandle) une copie de ce "ProcessHandle"

Example

var copyOfMyObject = myObject.clone();

equals

Renvoie vrai si ce "ProcessHandle" et un autre se réfèrent au même processus.

Syntaxe

myObject.equals(other);

Arguments

  1. other - (ProcessHandle) autre "ProcessHandle"

Renvoi

  • (bool) vrai si other se réfère au même processus

Example

if(myFirstObject.equals(mySecondObject))
	//Do something

toString

Renvoie une chaîne représentant ce "ProcessHandle".

Syntaxe

myObject.toString();

Renvoie

  • (string) une chaîne représentant ce "ProcessHandle"

Example

Console.print(myObject.toString());

Notes

Cette méthode est appelée automatiquement quand vous tentez de convertir un "ProcessHandle" en chaîne.

id

Renvoie l'identifiant du processus (id).

Syntaxe

myObject.id();

Renvoie

  • (entier) l'identifiant du processus (id)

kill

Tenter d'arrêter un processus.

Syntaxe

myObject.kill(killMode, timeout);

Arguments

  1. killMode - (KillMode) le mode d'arrêt à utiliser
  2. timeout - (entier) le délai d'attente en millisecondes quand on utilise "GracefulThenForceful"

Renvoie

  • (boolean) vrai si le processus a été arrêté.

isRunning

Renvoie vrai si le processus est actuellement en exécution.

Syntaxe

myObject.isRunning();

Renvoie

  • (boolean) vrai si le processus est actuellement en exécution

command

Returns the command that was used to start this process.

Syntax

myObject.command();

Returns

  • (string) the command that was used to start this process

Exceptions

  • (OpenProcessError) unable to open the process (Windows)
  • (GetModuleFilenameError) unable to get the module filename (Windows)
  • (GetProcessError) unable to get the process command (Linux)

priority

Returns the priority of this process.

Syntax

myObject.priority();

Returns

Exceptions

  • (OpenProcessError) unable to open the process (Windows)
  • (GetPriorityClassError) unable to get priority class (Windows)
  • (OperatingSystemError) this is not available on this operating system (Linux)

Notes

This method only works on Windows, because Linux doesn't have any concept of process priority.

Enumerations

KillMode

Policy to use when trying to kill a process.

Values

  1. Graceful: Linux: send a SIGTERM signal Windows: close all windows owned by this process
  2. Forceful: Linux: send a SIGKILL signal Windows: use TerminateProcess to kill this process
  3. GracefulThenForceful: try to kill the process using the graceful technique, wait for timeout and kill it using the forceful technique

Priority

A process priority.

Values

  1. AboveNormal: above normal
  2. BelowNormal: below normal
  3. High: high
  4. Idle: idle
  5. Normal: normal
  6. Realtime: realtime
fr/code/core/processhandle.1332329650.txt.gz · Dernière modification : 2021/02/13 11:23 (modification externe)