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

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 14-01-2007
JoeyJordison JoeyJordison is offline
No confirmado
 
Registrado: oct 2006
Posts: 68
Poder: 0
JoeyJordison Va por buen camino
Otra contrariedad

es que en el código de ejemplo jamas me hablan de que es una funcion.

Lo estoy implementando en el evento OnSHow del form
Responder Con Cita
  #2  
Antiguo 14-01-2007
JoeyJordison JoeyJordison is offline
No confirmado
 
Registrado: oct 2006
Posts: 68
Poder: 0
JoeyJordison Va por buen camino
Solamente quiero hacer una lista de todos los dispositivos de una pc en este caso de la mia.
Responder Con Cita
  #3  
Antiguo 14-01-2007
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, puede que esto te sirva de ayuda:

Coloca un TMemo en el form
Código Delphi [-]
uses SetupApi;

procedure TForm4.FormCreate(Sender: TObject);
var
  DevInfo: HDEVINFO;
  DevInfoData: SP_DEVINFO_DATA;
  i: integer;
  Data: Pointer;
  Size: DWORD;
begin
  DevInfo:= SetupDiGetClassDevs(nil,nil,0,DIGCF_ALLCLASSES or DIGCF_PROFILE);
  if DevInfo <> HDEVINFO(INVALID_HANDLE_VALUE) then
  begin
    FillChar(DevInfoData,Sizeof(DevInfoData),0);
    DevInfoData.cbSize:= Sizeof(DevInfoData);
    for i:= 0 to MAXINT do
    begin
      if not SetupDiEnumDeviceInfo(DevInfo,i,DevInfoData) then
        break;
      SetupDiGetDeviceRegistryProperty(DevInfo,DevInfoData,SPDRP_DEVICEDESC,
        nil,nil,0,@Size);
      if GetLastError = ERROR_INSUFFICIENT_BUFFER then
      begin
        GetMem(Data,Size);
        try
          if SetupDiGetDeviceRegistryProperty(DevInfo,DevInfoData,
            SPDRP_DEVICEDESC,nil,Data,Size,@Size) then
          begin
            // Recuerda colcoar el memo
            Memo1.Lines.Add(String(PChar(Data)));
          end;
        finally
          FreeMem(Data);
        end;
      end;
    end;
    SetupDiDestroyDeviceInfoList(DevInfo);
  end;
end;

Espero que este código en Delphi te aclare algo las cosas
Responder Con Cita
  #4  
Antiguo 14-01-2007
JoeyJordison JoeyJordison is offline
No confirmado
 
Registrado: oct 2006
Posts: 68
Poder: 0
JoeyJordison Va por buen camino
Mira ya he creado la función que se supone me recoja la lista de dispositivos del sistema, me quedó así:

Código Delphi [-]
var
  Form1: TForm1;
  DeviceInfoSet : HDEVINFO;
  NewDeviceInfoSet : HDEVINFO;

Código Delphi [-]
function CrearLista : Pointer;
begin
DeviceInfoSet := SetupDiCreateDeviceInfoList(NiL, HWND_TOP);
if (DeviceInfoSet = Pointer(INVALID_HANDLE_VALUE)) then
begin
ShowMessage('CreateDeviceInfoList failed: '+Inttostr(GetLastError()));
Result:=0;
Exit;
end;
NewDeviceInfoSet := SetupDiGetClassDevsEx(nil,Nil,HWND_DESKTOP,DIGCF_PRESENT or DIGCF_ALLCLASSES,DeviceInfoSet,NiL,NiL);
if (NewDeviceInfoSet = Pointer(Invalid_handle_value)) then
begin
ShowMessage('SetupDiGetClassDevsEx failed: '+inttostr(GetLastError));
Result:=0;
Exit;
end;
Result:=NewDeviceInfoSet;
end;
Para llamarla me dice que debo esperar al evento DBT_DEVICEARRIVAL
algo nuevo para mi, una funcion con eventos?
Responder Con Cita
Respuesta


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

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Utilizar Mem[] jsamuelsv Varios 0 14-10-2006 17:58:13
¿Existe algún problema si quiero utilizar 2 TQuery para la misma base de datos ? nuri SQL 4 28-07-2005 09:40:54
Utilizar La Web Cam jostrix Varios 5 29-05-2005 15:03:13
Utilizar Substring idatejo SQL 1 27-12-2004 17:50:06
Problema al utilizar dos bases de datos MySQL encontradas en diferentes Serveres FernandoFAI MySQL 3 16-04-2004 12:00:49


La franja horaria es GMT +2. Ahora son las 19:36:53.


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