StewSupport
asked on
moving mouse so it cancel screen saver
i have the code below with the intention of moving the mouse so the screen saver gets canceled. however it doesn't work. My mouse move but the screen saver still start. is there anything i need to do to make it stop? please help.
Imports System.Windows.Forms
Public Class MouseMover
Inherits System.Windows.Forms.Form
<Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function SetCursorPos(ByVal X As Integer, ByVal Y As Integer) As Boolean
End Function
Private Sub MouseMover_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
Timer1.Enabled = True
Timer1.Interval = 30000
Me.Visible = False
Me.ShowInTaskbar = False
Me.NotifyIcon1.Icon = Me.Icon
Me.NotifyIcon1.Visible = True
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim random As New Random
Dim x As Integer = random.Next
Dim y As Integer = random.Next
SetCursorPos(x, y)
End Sub
Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
NotifyIcon1.Dispose()
Application.Exit()
End Sub
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.