Hi guys !
I'm making an application with an API that detects the
mouse clicks (left, middle, and right).
I have this loop:
And again, no this is not a KEYLOGGER or anything close to that I don't support this kind of things.Code:Public Sub BackLoop() While Mode = True My.Application.DoEvents() If once = False Then TempScript = SideCompare(Cursor.Position) 'Some Function If TempScript <> Nothing Then once = True TempScript &= "|" End If Else Dim x As String = SideCompare(Cursor.Position) 'Some Function If x <> Nothing And Cursor.Position <> LastCoordinates Then TempScript &= x & "|" End If End If LastCoordinates = Cursor.Position My.Application.DoEvents() System.Threading.Thread.Sleep(5) End While End Sub
So what my problem is that it works fine but I have this
code that turns the loop off and then turn in back on:
this code make the loop go back on when the middle mouse button is up.Code:Private Sub MouseEvent(ByVal mEvent As Integer) Handles MHook.MouseEvent If mEvent = &H208 Then 'Middle Mouse Up Mode = False My.Application.DoEvents() Some code should be performed here My.Application.DoEvents() Mode = True Call BackLoop() End If End Sub
but the system freeze for a couple of seconds when this code is performed(the mouse can move but you can't do anything) when I removed these two lines:
the system continued to work as it should (the loop starts when the application start and my system doesnt freeze when it start), but when I add these lines againCode:Mode = True Call BackLoop()
the system freeze for a couple of seconds.
But I can't remove these two lines because I need the loop to go back on ,
how can I make the loop go back without the freeze issues?
Thank you!




Reply With Quote