PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → Tuer Application suivant PID
Tuer Application suivant PID
Started by Tragnée Michael, Nov., 30 2005 11:45 PM - 1 reply
Posted on November, 30 2005 - 11:45 PM
Bonjour à tous,

J'ai le PID d'une application Windev et j'aimerais savoir si elle est toujours active et si c'est le cas, la tuer à partir d'une autre application Windev...

Qui peut m'aider ?

MErci de votre aide,
Michael
Posted on December, 01 2005 - 12:03 PM
PROCEDURE WindowsListeProcess(ExtraitTitre="",Action="")

title est une chaîne ASCIIZ sur 256;

className est une chaîne ASCIIZ sur 256;

hwnd est un entier = AppelDLL32("user32","FindWindowExA" , Null, Null, Null,
Null)

pPid est un entier //; //LPDWORD

lresult est un entier //; //DWORD

hg est un entier //; //HGLOBAL

id1 est un entier //;

Liste est chaîne

TANTQUE hwnd<>Null


hg = AppelDLL32("kernel32","GlobalAlloc" , 8192 , 4)


pPid = AppelDLL32("kernel32","GlobalLock" , hg)


lresult = AppelDLL32("user32","GetWindowThreadProcessId" , hwnd, pPid)



SI lresult ALORS

AppelDLL32("user32","GetClassNameA" , hwnd, &className, 256)

AppelDLL32("user32","GetWindowTextA" , hwnd, &title, 256)


Transfert(&id1,pPid,4);

SI ExtraitTitre="" OU (ExtraitTitre<>"" ET
Position(Minuscule(title),Minuscule(ExtraitTitre))>0) ALORS

SI ExtraitTitre<>"" ET Action<>"" ALORS

SELON Action

CAS "KILL"

SendMessage(hwnd,WM_CLOSE,0,0)

FIN

FIN

SI Liste<>"" ALORS Liste = Liste + RC

Liste = Liste + id1+TAB+title+TAB+className+TAB+hwnd

FIN

FIN

AppelDLL32("kernel32","GlobalUnlock" , hg)

AppelDLL32("kernel32","GlobalFree" , hg)


hwnd = AppelDLL32("user32","FindWindowExA" , Null, hwnd, Null, Null)


FIN

RENVOYER Liste





"Tragnée Michael" <tragnee@skynet.be> a écrit dans le message de news:
438e252a$1@news.pcsoft.fr...
Bonjour à tous,

J'ai le PID d'une application Windev et j'aimerais savoir si elle est
toujours active et si c'est le cas, la tuer à partir d'une autre
application Windev...

Qui peut m'aider ?

MErci de votre aide,
Michael