🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.basic.visual
Article #152

Re: Moving the mouse.

#152
From: Qixel ( Former Name: Q-Spawn )
Date: Fri, 08 Oct 1999 00:00
42 lines
2289 bytes
Hi,

here's and Example of using the API Call SetCursorPos

Public Declare Function SetCursorPos Lib "user32" Alias "SetCursorPos"
(ByVal x As Long, ByVal y As Long) As Long

Function MouseHere(MouseX AS Integer, MouseY AS Integer) AS Boolean
    'Get the Screen Resolution...   ScreenX by ScreenY in Pixels
    ScreenX = Screen.Width / Screen.TwipsPerPixelX
    ScreenY = Screen.Height / Screen.TwipsPerPixelY

    'Check to see if the New Co-ords are with in the Screen Resolution
    IF MouseX > ScreenX THEN MouseX = ScreenX
    IF MouseX < 0 THEN MouseX = 0

    IF MouseY > ScreenY THEN MouseY = ScreenY
    IF MouseY < 0 THEN MouseY = 0

    'Set the Mouse Cursor at the New Position
    SetCursorPos MouseX, MouseY

    'Set the Function to True because the the Whole Subroutine ran
    MouseHere = TRUE
End Function

Sub Form_Load()
    MsgBox MouseHere(100, 100), vbOKOnly, "MouseHere Return Value"
End Sub


: )
any Questions ask me : )


Lonnie Boudreaux wrote:

> Does anyone know how to make a program move a mouse on the screen,
> hopefully predetermined places.  Like sending keystrokes maybe.
>
> Thanks
> Lonnie
Technical Details
Message-ID: <37FE5E0D.F1F5933A@telusplanet.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <MPG.1266fb96fd33d66989680@news1.lig.bellsouth.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb992,63f552b98eacd03e
X-Google-Attributes: gidfb992,public
X-Google-Thread: 110e3b,63f552b98eacd03e
X-Google-Attributes: gid110e3b,public
X-Google-Thread: 108062,63f552b98eacd03e
X-Google-Attributes: gid108062,public
X-Google-Thread: f645d,63f552b98eacd03e
X-Google-Attributes: gidf645d,public
X-Google-Thread: 1017ee,63f552b98eacd03e
X-Google-Attributes: gid1017ee,public
From: "Qixel ( Former Name: Q-Spawn )" <systemadmin@telusplanet.net>
Subject: Re: Moving the mouse.
Date: 1999/10/08
Message-ID: <37FE5E0D.F1F5933A@telusplanet.net>
X-Deja-AN: 534450018
Content-Transfer-Encoding: 7bit
References: <MPG.1266fb96fd33d66989680@news1.lig.bellsouth.net>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Trace: news0.telusplanet.net 939413551 161.184.29.45 (Fri, 08 Oct 1999 14:12:31 MDT)
Organization: Qewl Software
MIME-Version: 1.0
NNTP-Posting-Date: Fri, 08 Oct 1999 14:12:31 MDT
Newsgroups: comp.lang.basic.visual,comp.lang.basic.visual.misc,comp.lang.visual.basic,cz.comp.lang.basic.visual,fj.comp.lang.basic