Author Topic: WinUSB WndProc()  (Read 4007 times)


  • Frequent Contributor
  • ****
  • Posts: 58
WinUSB WndProc()
« on: February 09, 2014, 09:14:14 am »
I am using WinUSB VB codes to display list of the devices that uses the same inf driver and then perform different task on each device.

The problem was if I connected and disconnected other USB devices (mouse, keyboard and etc), the OnDeviceChange() is executed.

I would like to have OnDeviceChange() executed if and only if any WinUSB device (same inf driver) is connected/ disconnected. Previously, I am thinking of to add in codes to count the number of WinUSB devices to do so. Please advise if there is better approach to implement this, thanks.

        Protected Overrides Sub WndProc(ByRef m As Message)
                If m.Msg = DeviceManagement.WM_DEVICECHANGE Then
                End If
            Catch ex As Exception
            End Try
        End Sub

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3016
    • Lakeview Research
Re: WinUSB WndProc()
« Reply #1 on: February 09, 2014, 09:59:39 am »
Why not capture all changes and search for your device by path name?

My latest WinUSB examples use WMI instead of OnDeviceChange:
« Last Edit: July 13, 2014, 09:55:42 pm by Jan Axelson »