Hola DSK25.
Código:
#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:
Código:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (IsAppRunning("mspaint.exe"))
ShowMessage("Se está ejecutando");
else
ShowMessage("No se esta ejecutando");
}
Saludos