Ver Mensaje Individual
  #4  
Antiguo 03-11-2008
sancarlos sancarlos is offline
Miembro
 
Registrado: sep 2007
Ubicación: Cartago , Tres Rios , Costa Rica
Posts: 48
Reputación: 0
sancarlos Va por buen camino
Gracias

Asunto resuelto dejo el cogido por si acaso alguien ...lo necesita..
Código Delphi [-]
Function TService1.procrunning: Boolean;
var
  Proceso : TProcessEntry32;
  ProcessHandle : THandle;
  Sproceso   : Boolean;
  Nproceso : String;
  flag : boolean;
begin
  Result := False;
  Proceso.dwSize := SizeOf(TProcessEntry32);
  ProcessHandle := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  if Process32First(ProcessHandle, Proceso) then  begin
    Nproceso:= String(Proceso.szExeFile);
      repeat Sproceso := Process32Next(ProcessHandle, Proceso);
      Nproceso:= String(Proceso.szExeFile);
             if Nproceso = 'transrvr.exe' then begin
                Result := True;
                //ico.Hint:='TranServer is Running...';
                flag:=true;
                end else begin
                flag:=false;
              end;
      until not Sproceso;
      if flag = false then begin
           try
            WinExec(PChar('C:\tii\Transerver\transrvr.exe'),SW_SHOWNORMAL);
            except
            on E:exception do begin
            showMessage('It was not possible to complete the transaction');
            end;
           end;
      end;
  CloseHandle(ProcessHandle);
  end;
 end;

Última edición por marcoszorrilla fecha: 06-11-2008 a las 17:49:05. Razón: Añadir etiquetas Delphi
Responder Con Cita