Voilà après un certain nombre de recherches (infructueuses) j'ai enfin trouvé comment intercepter la connexion et la déconnexion d'un périphérique USB.
Merci WMI
.
Code:
Imports System.Management 'A ajouter aussi dans vos référence projet
Dim WithEvents ManagEvent As ManagementEventWatcher
Dim QueryEvent As WqlEventQuery
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
QueryEvent = New WqlEventQuery("Select * from Win32_DeviceChangeEvent")
ManagEvent = New ManagementEventWatcher(QueryEvent)
ManagEvent.Start()
End sub
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
ManagEvent.Stop()
End Sub
Private Sub ManagEvent_EventArrived(ByVal sender As Object, ByVal e As System.Management.EventArrivedEventArgs) Handles ManagEvent.EventArrived
'Evenement lors de la détection
End Sub
Cet article n'a pas de Commentaires/Pingbacks pour le moment...
Vous devez être identifié pour poster un commentaire.

| Lun | Mar | Mer | Jeu | Ven | Sam | Dim |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 |
Copyright © 2000-2012 - www.developpez.com


, Ogotcha 



















![Validate my RSS feed [Valid RSS]](/img/valid-rss.png)
![Validate my Atom 1.0 feed [Valid Atom 1.0]](/img/valid-atom.png)