Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #26  
Antiguo 10-09-2012
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.210
Poder: 22
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Mira a ver si esto te sirve de ayuda:

Código Delphi [-]
function GetDeviceName: String;
var
 hKey: Windows.HKEY;
 Device: ShortString;
 Key: String;
 Count, Len: Cardinal;
begin
 Result:= '';
 RegOpenKey(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Services\WpdUsb\Enum', hKey);
 RegQueryValueEx(hKey, 'Count', nil, nil, @Count, @Len);
 if Count = 1 then
 begin
   Len:= sizeof(Device);
   RegQueryValueEx(hKey, '0',  nil, nil, @Device[1], @Len);
   Device[0]:= CHAR(Len-1);
   Device:= Copy(Device, Pos('Vid', Device), Pos('Pid_', Device)+7 - Pos('Vid', Device)+1);
   RegCloseKey(hKey);
   Key:= 'SYSTEM\CurrentControlSet\Enum\USB\' + Device;
   RegOpenKey(HKEY_LOCAL_MACHINE, PCHAR(Key), hKey);
   RegEnumKey(hKey, 0, @Device[1], SizeOf(Device) - 1);
   Device[0]:= CHAR(lstrlen(@Device));
   RegCloseKey(hKey);
   RegOpenKey(HKEY_LOCAL_MACHINE, PCHAR(Key + '\' + Device), hKey);
   RegQueryValueEx(hKey, 'Service', nil, nil, @Device[1], @Len);
   RegCloseKey(hKey);
   Device[0]:= CHAR(Len-1);
   RegOpenKey(HKEY_LOCAL_MACHINE, PCHAR('SYSTEM\CurrentControlSet\Services\' + Device), hKey);
   RegCloseKey(hKey);
   Key:= 'SYSTEM\CurrentControlSet\Services\' + Device + '\Enum';
   RegOpenKey(HKEY_LOCAL_MACHINE, PCHAR(Key), hKey);
   RegQueryValueEx(hKey, 'Count', nil, nil, @Count, @Len);
   if Count = 1 then
   begin
     Len:= sizeof(Device);
     RegQueryValueEx(hKey, '0',  nil, nil, @Device[1], @Len);
     Device[0]:= CHAR(Len-1);   // Ahora tenemos el device y el serial
   end;
   RegCloseKey(hKey);
   Key:= 'SYSTEM\CurrentControlSet\Enum\USB\' + Copy(Device, 5, Length(Device)-4) + '\Device Parameters';
   RegOpenKey(HKEY_LOCAL_MACHINE, PCHAR(Key), hKey);
   Len:= sizeof(Device);
   RegQueryValueEx(hKey, 'SymbolicName', nil, nil, @Device[1], @Len);
   RegCloseKey(hKey);
   Device[0]:= CHAR(Len);
   Result:= Device;
   Result[2]:= '\';
   Result[3]:= '.';
 end
 else
   RegCloseKey(hKey);
end;

Su Uso:
Código Delphi [-]
hFile:= CreateFile(PCHAR(GetDeviceName),
                     GENERIC_READ or GENERIC_WRITE,
                     FILE_SHARE_READ or FILE_SHARE_WRITE,
                     nil, 
                     OPEN_EXISTING,
                     FILE_FLAG_WRITE_THROUGH or FILE_FLAG_NO_BUFFERING, 
                     0);


Saludos.
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

Temas Similares
Tema Autor Foro Respuestas Último mensaje
ver los contactos de un celular con delphi kurono Varios 0 02-07-2011 00:01:21
No pongas el celular en el bolsillo del pantalon jcarteagaf La Taberna 4 25-07-2008 19:40:53
infectar un celular ciro.arc Seguridad 10 19-07-2008 18:00:36
Programación de un celular hugoChinchilla Conexión con bases de datos 7 14-09-2007 05:09:18
Y asi hay gente que se descresta con un celular mamcx La Taberna 3 14-03-2007 23:14:20


La franja horaria es GMT +2. Ahora son las 18:27:19.


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