Ver Mensaje Individual
  #1  
Antiguo 19-09-2008
jocey jocey is offline
Miembro
 
Registrado: ene 2007
Posts: 111
Reputación: 18
jocey Va por buen camino
Iniciar servicio de windows

Hola familia este codigo lo copie de una pagina y cuando lo compilo me da el siguiente error:

Constant expresion violate subrange bounds.

el codigo es el sgte, y el erros es en la linea que tengo subrayada en rojo.

Código Delphi [-]
function iniciarServicio (sMachine, sService: String) : Boolean;
var
  schm,
  schs: SC_Handle;
  ss: TServiceStatus;
  psTemp: PChar;
  dwChkP: DWord;
begin
  ss.dwCurrentState := -1;
  schm := OpenSCManager(PChar(sMachine), nil, SC_MANAGER_CONNECT);
  if (schm>0) then
  begin
    schs := OpenService(schm, PChar(sService), SERVICE_START or
      SERVICE_QUERY_STATUS);
    if (schs>0) then
    begin
      psTemp := nil;
      if (StartService(schs, 0, psTemp)) then
        if (QueryServiceStatus(schs, ss)) then
          while (SERVICE_RUNNING<>ss.dwCurrentState) do
          begin
            dwChkP := ss.dwCheckPoint;
            Sleep(ss.dwWaitHint);
            if (not QueryServiceStatus(schs, ss)) then
              Break;
            if (ss.dwCheckPoint < dwChkP) then
              Break;
          end;
      CloseServiceHandle(schs);
    end;
    CloseServiceHandle(schm);
  end;
  Result := SERVICE_RUNNING=ss.dwCurrentState;
end;

cualquier ayuda sera bienvenida.
Gracias de antemano
Responder Con Cita