I have a slightly malfunctioning mouse. My problem is that when my computer wakes up, often my mouse stops working. The light remains on and all buttons work but I cannot move my mouse until I unplug it and plug it back in.

I've written programs to fix strange issues I've had so I'm working on a program that will reset my mouse (So I don't have to manually unplug it) on wake. I tried using devcon to reset the driver using this:

    Private Sub DevCon()
        Dim DevCon As New Process
        Dim err As Integer = 0
        '0 = No error
        '1 = No device found
        DevCon.StartInfo.UseShellExecute = False
        DevCon.StartInfo.RedirectStandardOutput = True
        DevCon.StartInfo.RedirectStandardInput = True
            DevCon.StartInfo.FileName = "C:\devcon.exe"
            DevCon.StartInfo.Arguments = "restart HID_DEVICE_SYSTEM_MOUSE"
            DevCon.StartInfo.CreateNoWindow = True
            Dim sr As System.IO.StreamReader = DevCon.StandardOutput
            Dim line As String
            Do While DevCon.HasExited = False
                line = sr.ReadLine
                Select Case True
                    Case Is = line.Contains("device(s) restarted")
                        err = 0
                    Case Is = line.Contains("no matching devices found")
                        err = 1
                End Select
        Catch ex As Exception
            Select Case err
                Case Is = 1
                    MsgBox("Incorrect device name.", MsgBoxStyle.Critical, Application.ProductName)
            End Select
            If ex.InnerException.InnerException.Message IsNot Nothing Then
                MsgBox(ex.Message & vbNewLine & vbNewLine & ex.InnerException.InnerException.Message, MsgBoxStyle.Critical, Application.ProductName)
                MsgBox(ex.Message, MsgBoxStyle.Critical, Application.ProductName)
            End If
        End Try
    End Sub

I use that with Microsoft.Win32.PowerModes enumeration, handling power mode changed to figure out if the computer has awoken. The problem is the code doesn't work as expected. It restarts the device but the problem still persists. I should probably note that the reason I use HID_DEVICE_SYSTEM_MOUSE rather than the actual hardware ID of my mouse (HID/VID_045E&PID_0047&REV_0300) results in no devices being found matching that ID.

Does anyone know of a way to fully restart the device? Like a completely shutdown of the device and driver that would definitely yield better results? Thank you!

Edited by Darkicon

3 Years
Discussion Span
Last Post by Darkicon

It restarts the device but the problem still persists.

Might be a hardware problem. Do you have another mouse you can try? Is it a USB mouse? Try plugging it into another USB port to see if it's a bad USB port.


Is this a wireless mouse? I've been having problems for over a year on my 5-year old Dell Inspiron laptop, mostly when I restore from hibernation; almost never when I restore from sleep mode. I've had this happen with two wireless mice and it seems to happen more frequently on the rear ports than the side ports. I even rebuilt the OS from scratch to see if it was a software problem. I suspect it is a hardware problem but it is not serious enough to warrant getting anything fixed. The only thing that works is to remove and reinsert the USB adaptor.


It's an old wired Microsoft optical mouse. The mouse is very old and the problem only occurs on this particular mouse, regardless of which USB hub/port it happens to be in. But I like this mouse and other than that malfunction-on-wake issue, it's fine.

On a side note, strangely enough it appears resetting the USB hub the mouse is plugged into does fix the issue.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.