title: Portable Device Detection
body: <p>I need a functionality in my program (written in VB.NET) that detects whether the USB Portable Device (Windows CE 5.0) is inserted or removed. I have found a VB.NET code from the internet but it only works with USB Storage Devices... I only found codes and sample programs (written in C++) that does this USB Portable Device detection, but I can't understand the logic/program flow so I can't convert it to VB.NET</p>
  
  <p>Here are the VB.NET codes that detects USB Storage Devices (lacks detection for USB Portable Devices):</p>
  
  <pre><code>Public Class Form1
  
      Private WM_DEVICECHANGE As Integer = &amp;H219
  
      Public Enum WM_DEVICECHANGE_WPPARAMS As Integer
          DBT_CONFIGCHANGECANCELED = &amp;H19
          DBT_CONFIGCHANGED = &amp;H18
          DBT_CUSTOMEVENT = &amp;H8006
          DBT_DEVICEARRIVAL = &amp;H8000
          DBT_DEVICEQUERYREMOVE = &amp;H8001
          DBT_DEVICEQUERYREMOVEFAILED = &amp;H8002
          DBT_DEVICEREMOVECOMPLETE = &amp;H8004
          DBT_DEVICEREMOVEPENDING = &amp;H8003
          DBT_DEVICETYPESPECIFIC = &amp;H8005
          DBT_DEVNODES_CHANGED = &amp;H7
          DBT_QUERYCHANGECONFIG = &amp;H17
          DBT_USERDEFINED = &amp;HFFFF
      End Enum
  
      Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
          If m.Msg = WM_DEVICECHANGE Then
              Select Case m.WParam
                  Case WM_DEVICECHANGE_WPPARAMS.DBT_DEVICEARRIVAL
                      lblMessage.Text = "USB Inserted"
                  Case WM_DEVICECHANGE_WPPARAMS.DBT_DEVICEREMOVECOMPLETE
                      lblMessage.Text = "USB Removed"
                  End Select
          End If
          MyBase.WndProc(m)
      End Sub
  End Class
  </code></pre>
  
  <p>What must I add to this code so it could detect Windows USB Portable Devices as well?
  I need the codes to be in VB.Net...</p>
  
  <p>BTW, Using the program written in C++, it says that my USB Portable Device has the following Properties:</p>
  
  <pre><code>VID - 045E
  PID - 00CE
  </code></pre>
  
  <p>Thanks for helping out! :)</p>