Nuevas NORMAS para el foro
Bienvenido(a),
Visitante
. Favor de
ingresar
o
registrarse
.
¿Perdiste tu
email de activación?
- Julio 06, 2008, 04:55:01
Boton Buscar
Visita:
Articulos
-
Juegos Gratis
-
Da Foros
Comunidad Underground Hispana
|
Programacion
|
Programación
|
Visual Basic y Net
(Moderador:
ANYD00M
) | Tema:
Detectar Unidades USB
0 Usuarios y 1 Visitante están viendo este tema.
« anterior
próximo »
Páginas:
[
1
]
Autor
Tema: Detectar Unidades USB (Leído 53 veces)
Deeo
Miembro
Desconectado
Mensajes: 108
Ozzy Slave.
Detectar Unidades USB
«
en:
Mayo 30, 2008, 09:50:36 »
Bueno este código no recuerdo de donde lo saque pero no es mío.
Sirve para detectar cuando se conecta una Unidad USB para ello necesitaremos:
Un modulo, donde colocaremos el siguiente código:
Public Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Public Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Public Declare Function GetLogicalDrives Lib "kernel32" () As Long
'VARIABLE QUE VA A TOMAR EL MOMBRE DE LA UNIDAD
Public UnidadUSB As String
Public Function GetDriveSerial(ByVal sDrive As String) As Long
sDrive = UCase(Left$(sDrive, 1)) & ":\"
Call GetVolumeInformation(sDrive, vbNullString, 0, GetDriveSerial, 0, 0, vbNullString, 0)
UnidadUSB = sDrive
End Function
Public Function IsConnected(ByVal lID As Long) As Boolean
Dim LDs As Long, Cnt As Long, sDrives As String
LDs = GetLogicalDrives
For Cnt = 0 To 25
If (LDs And 2 ^ Cnt) <> 0 Then
sDrives = sDrives + Chr$(65 + Cnt)
If GetDriveType(Trim(Right(sDrives, 1) & ":\")) = 2 Then
UnidadUSB = Trim(Right(sDrives, 1) & ":\")
End If
End If
Next Cnt
End Function
Y un Formulario, donde colocaremos un Timer y una Label y el siguiente código:
Private Sub Form_Load()
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
IsConnected (0)
Label1.Caption = UnidadUSB
End Sub
Bueno espero que les sirva. Salu2.
Deeo
En línea
Páginas:
[
1
]
Comunidad Underground Hispana
|
Programacion
|
Programación
|
Visual Basic y Net
(Moderador:
ANYD00M
) | Tema:
Detectar Unidades USB
« anterior
próximo »
Ir a:
Por favor selecciona un destino:
-----------------------------
Foros De Consulta General
-----------------------------
=> Novedades
=> Dudas, Comentarios Y Sugerencias
=> Top 100
=> Off-Topic
=> Revista E-Zine
===> Noticias
-----------------------------
Phreaking, Hacking y Seguridad
-----------------------------
=> HacK GeneraL
===> Ingenieria Inversa
===> Encriptacion, Cryptografia
===> TV HACK
===> Seguridad
===> Cursos y Ezines
=====> Trucos Internet
=====> Textos Hacking
===> Defacing
=> Phreaking
===> Moviles
=> Bug y Exploits
-----------------------------
Hack Novato
-----------------------------
=> Hack para newbies
=> Todo Messenger
=> Troyanos y virus
-----------------------------
Sistemas Operativos
-----------------------------
=> Windows y otros sistemas operativos no libres
===> Problemas Tecnicos Windows
=> Sistemas operativos libres.
===> GNU/Linux
===> Manuales y Tutoriales
===> Descargas
-----------------------------
Programacion
-----------------------------
=> Programación
===> Programación Basica
===> Otros Lenguajes
===> Visual Basic y Net
===> ASM
===> Programacion Shell
===> Perl
===> Carbide C/C#/C++
===> Batch
===> SQL
=> Programacion para webmasters
===> Consultas
===> Php
===> Html
===> Java - Java Script
===> Php Nuke
===> Scripts Pre-Fabricados
===> Mysql
===> CSS y Diseño Web
-----------------------------
Artes Graficas
-----------------------------
=> Diseño Grafico
===> Battle Arts
===> Flash
===> Tutoriales
===> Galerías
===> Software
-----------------------------
Area Tecnica
-----------------------------
=> Networking & Wireless
=> Overclocking, Refrigeracion y demas
=> Hardware
===> Cursos Y manuales
=> Electronica Y Robotica
-----------------------------
Programas
-----------------------------
=> Software
===> Configuraciones de software
===> Pedidos de software
=> Cracks & Serialz
=> P2p, Bittorrent, Elinks
-----------------------------
Multimedia Y Divx
-----------------------------
=> Juegos PC Y Consolas
===> Dudas ayudas y comentarios de juegos
===> Pedidos de juegos
=> Mp3
=> Multimedia
=> Peliculas Divx
-----------------------------
Entretenimiento Y sitios de interes
-----------------------------
=> Juegos, Humor y Adultos. (Diversión)
===> Adultos
=> Paginas Webs Recomendadas
=> Videos
Powered by SMF 1.1.5
|
SMF © 2006-2007, Simple Machines LLC
Loading...