Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 23-09-2005
Avatar de jmariano
jmariano jmariano is offline
Miembro
 
Registrado: jul 2005
Posts: 376
Poder: 21
jmariano Va por buen camino
No se como estarás invocando la función pero te pongo un código que encontré sobre este tema y que, según su autor, funciona en el Windows Server 2003 (es necesario entrar con una cuenta local de administrador):

Código Delphi [-]
function ServiceGetList(sMachine: string; slServicesList: TStrings): Boolean;
type
  TSvcA = array[0..0] of TEnumServiceStatus;
  PSvcA = ^TSvcA;
var
  j: integer;
  schm: SC_Handle;
  nBytesNeeded, nServices, nResumeHandle: Cardinal;
  ssa: PSvcA;
begin
  Result := False;
  
  try
    schm := OpenSCManager(PChar(sMachine), nil, SC_MANAGER_ENUMERATE_SERVICE);

    if schm <> 0 then
      begin
        nResumeHandle := 0;
        nServices := 0;
        nBytesNeeded := 0;
        ssa := nil;
      
        EnumServicesStatus(schm, SERVICE_TYPE_ALL, SERVICE_STATE_ALL, ssa[0],
          SizeOf(ssa), nBytesNeeded, nServices, nResumeHandle);
          
        GetMem(ssa, nBytesNeeded);
        
        EnumServicesStatus(schm, SERVICE_TYPE_ALL, SERVICE_STATE_ALL, ssa[0],
          nBytesNeeded, nBytesNeeded, nServices, nResumeHandle);
          
        for j := 0 to nServices - 1 do
          begin
            slServicesList.Add(StrPas(ssa[j].lpDisplayName));
            slServicesList.Add(StrPas(ssa[j].lpServiceName));
          end;
          
        Result := True;
        FreeMem(ssa);
        CloseServiceHandle(schm);
      end;
  except
  end;
end;

Saludos!

Última edición por jmariano fecha: 23-09-2005 a las 12:57:50.
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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


La franja horaria es GMT +2. Ahora son las 19:59:51.


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