Ver Mensaje Individual
  #2  
Antiguo 03-04-2014
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
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
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita