Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 08-01-2008
MON___ MON___ is offline
Miembro
 
Registrado: abr 2007
Ubicación: Salamanca (España)
Posts: 84
Poder: 18
MON___ Va por buen camino
No me crea el SERVICIO

¿Alguien me puede explicar dónde está el error en esta función? En ella compruebo la existencia de un servicio y si no existe intento crearlo (¡y aquí está el error!)
Código Delphi [-]
function CrearServicioApache : boolean;
  var
    ServicioControl : SC_Handle;
    Servicio : SC_Handle;
    Path     : string;
begin
  Result := False;
  ServicioControl := OpenSCManager(nil, nil, SC_MANAGER_CONNECT);
  if ServicioControl <> 0 then
  begin
    Servicio := OpenService(ServicioControl, 'Apache 2', SERVICE_ALL_ACCESS);
    if Servicio <> 0 then  
      CloseServiceHandle(Servicio)
    else  //no existe el servicio e intento crearlo
    begin
      path := '"c:\apache\apache2\bin\apache.exe" -k runservice';
      Servicio := CreateService(ServicioControl,
                               'Apache 2', 'Servidor Apache',
                               SC_MANAGER_ALL_ACCESS or SC_MANAGER_CREATE_SERVICE,
                               SERVICE_WIN32_OWN_PROCESS,
                               SERVICE_DEMAND_START,
                               SERVICE_ERROR_IGNORE,
                               PChar(Path), nil, nil, nil, nil, nil);
      if Servicio <> 0 then
      begin
        Result := True;
        CloseServiceHandle(Servicio);
      end;
    end;
    CloseServiceHandle(ServicioControl);
  end;
end;

Postdata: Sistema operativo WINDOWS XP

Última edición por jachguate fecha: 09-01-2008 a las 02:38:59. Razón: Etiqueta code
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
(fatal error) no me crea el exe douglas OOP 8 24-01-2012 18:04:56
Como arrancar o parara un servicio en funcion de otro servicio ?? QuarkBcn API de Windows 12 15-06-2011 14:46:11
¿Cómo se crea una pequeña dll? REHome OOP 6 24-10-2005 12:09:09
programa que crea programas JXJ Varios 4 06-09-2005 17:20:42
No me crea la bd al instalar davgoncam Oracle 8 07-03-2004 14:31:26


La franja horaria es GMT +2. Ahora son las 18:41:15.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi