Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #7  
Antiguo 21-11-2006
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Poder: 26
seoane Va por buen camino
Bueno, de mi no se esconde nadie

Si el nombre se puede escoger, ¿también el nombre del ejecutable?

Buscar servicio por el nombre del ejecutable:
Código Delphi [-]
uses WinSvc;

// Para comprobar si el servicio esta instalado
function isInstalled2(Nombre: String): Boolean;
var
  ServiceControlManager: SC_HANDLE;
  Status, P: PEnumServiceStatus;
  Size, Count, Resume, i: DWORD;
  Service: SC_HANDLE;
  Config: PQueryServiceConfig;
begin
  Result:= FALSE;
  ServiceControlManager:= OpenSCManager(nil, nil, SC_MANAGER_CONNECT or
    SC_MANAGER_ENUMERATE_SERVICE);
  if ServiceControlManager <> 0 then
  begin
    GetMem(Status,Sizeof(TEnumServiceStatus));
    try
      EnumServicesStatus(ServiceControlManager,SERVICE_WIN32,SERVICE_STATE_ALL,
        Status^,0,Size,Count,Resume);
      if GetLastError = ERROR_MORE_DATA then
      begin
        FreeMem(Status);
        GetMem(Status,Size);
        if EnumServicesStatus(ServiceControlManager,SERVICE_WIN32,SERVICE_STATE_ALL,
          Status^,Size,Size,Count,Resume) then
        begin
          P:= Status;
          for i:= 1 to Count do
          begin
            if Result then
              break;
            Service:= OpenService(ServiceControlManager,P.lpServiceName,
              GENERIC_READ);
            if Service <> 0 then
            begin
              GetMem(Config,Sizeof(QUERY_SERVICE_CONFIG));
              try
                QueryServiceConfig(Service,Config,0,Size);
                if GetLastError = ERROR_INSUFFICIENT_BUFFER then
                begin
                  FreeMem(Config);
                  GetMem(Config,Size);
                  if QueryServiceConfig(Service,Config,Size,Size) then
                    if AnsiSameText(
                      Copy(ExtractFileName(String(Config.lpBinaryPathName)),1,
                      Length(Nombre)), Nombre) then
                      Result:= TRUE;
                end;
              finally
                FreeMem(Config);
              end;
              CloseServiceHandle(Service);
            end;
            inc(P);
          end;
        end;
      end;
    finally
      FreeMem(Status);
    end;
    CloseServiceHandle(ServiceControlManager);
  end;
end;

No estoy seguro del nombre del ejecutable del servicio de MySql pero según google comienza por mysql, si lo tienes instalado compruebalo.

Código Delphi [-]
if not isInstalled2('mysql') then
begin
  // Lo que tu quieras
end;

¿Y ahora que Roman?

Última edición por seoane fecha: 21-11-2006 a las 21:03:20.
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
saber si esta php instalado coulthard Internet 4 20-04-2006 19:56:43
Saber si un puerto está en uso Sr_Sombrero Internet 2 06-04-2006 15:26:38
Saber si una unidad de Red esta conectada comba API de Windows 2 18-04-2005 19:57:02
Saber si un formulario ya está creado o no. Tecnic2 OOP 2 27-09-2004 13:27:01
Saber si esta conectado Kaesbu Internet 1 22-09-2003 14:09:45


La franja horaria es GMT +2. Ahora son las 08:24:45.


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