Ver la Versión Completa : Como saber si una aplicación se esta ejecutando?
DSK25
02-04-2014, 23:23:03
Hola Club Delphi, con que código puedo saber si una aplicación cualquiera se esta ejecutando? :)
ecfisa
03-04-2014, 03:13:48
Hola DSK25.
#include<tlhelp32>
bool IsAppRunning(AnsiString ExeFileName)
{
PROCESSENTRY32 Entry;
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
Entry.dwSize = sizeof(PROCESSENTRY32);
if (Process32First(hSnapShot, &Entry))
while(Process32Next(hSnapShot, &Entry))
if (strcmp(Entry.szExeFile, ExeFileName.c_str())== 0)
return true;
return false;
}
Ejemplo de uso:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (IsAppRunning("mspaint.exe"))
ShowMessage("Se está ejecutando");
else
ShowMessage("No se esta ejecutando");
}
Saludos :)
DSK25
03-04-2014, 17:11:56
Gracias ecfisa ^\||/
vBulletin v3.6.8, Derechos ©2000-2024, Jelsoft Enterprises Ltd.