Que quería ver si alguien me podría explicar y poner un módulo que detecte el usb y en tal caso haga un msgbox o algo asi xD, encontre esto :

[Enlace externo eliminado para invitados] ... 527.0.html


pero el módulo no se usarlo XD. haber si alguien me echa una hand xD
Imagen

http://img844.imageshack.us/img844/8088/mujerrara.jpg
http://img715.imageshack.us/img715/5813/tigree.png
http://img830.imageshack.us/img830/6484/camaleon.png

http://img839.imageshack.us/img839/4944/tigrev2.jpg
http://img843.imageshack.us/img843/443/spidermanxn.png

http://www.youtube.com/watch?v=wHYYkciIKE0
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
creo que es asi:
Le asignamos a la variable USB el valor de IsConnected y si devuelve True esta conectado y si devuelve False entonces no esta conectado , creo que es eso , si fuera asi entonces proba esto:

dim USB
USB = IsConnected("H") 'H es la letra de la unidad
if USB = True then
Msgbox "La unidad H esta conectada", vbInformation + VbOkonly
else
Msgbox "La unidad H no esta conectada", vbInformation + VbOkonly
end if

creo que es asi, no lo he probado
Imagen

"Me saltó el avira cuando estaba mirando la foto de slandg... ¿como puedo modearlo? " - Skillmax
Yo ya lo solucione, luego pruevo tu code men, y en delphi pues ni idea lo siento...


THx igualmente !
Imagen

http://img844.imageshack.us/img844/8088/mujerrara.jpg
http://img715.imageshack.us/img715/5813/tigree.png
http://img830.imageshack.us/img830/6484/camaleon.png

http://img839.imageshack.us/img839/4944/tigrev2.jpg
http://img843.imageshack.us/img843/443/spidermanxn.png

http://www.youtube.com/watch?v=wHYYkciIKE0
Responder

Volver a “VB/.NET”