Does anyone within the forum know how to set the mouse cursor to a specific position within a window using Creative Basic.
I have tried the following code but this doesn't seem to work.
@MOUSEX =100
@MOUSEY = 100
I would be grateful if anyone within the forum can help with the problem.
Hi,
You need the SetCursorPos API call. I have just tried it and it works, but how you
get it to be inside your own program window I just don't know
Have a search on the 'net for it
Brian
DECLARE "user32.dll",SetCursorPos(x:INT, y:INT),INT
DECLARE "user32.dll",ClientToScreen(hwnd:INT, lpPoint:POINTAPI),INT
TYPE point
DEF x:INT
DEF y:INT
ENDTYPE
def pt:Point
def run:int
def w1:window
window w1,100,100,400,400,@TOOLWINDOW,0,"Position Mouse",mainwin
control w1,"B,Move,10,10,80,30,0,1"
run = 1
waituntil run=0
closewindow w1
end
sub mainwin
select @class
CASE @IDCLOSEWINDOW
run = 0
case @idcontrol
select @controlid
case 1
pt.x=300
pt.y=300
ClientToScreen(w1.hwnd, pt)
SetCursorPos(pt.x,pt.y)
endselect
endselect
return
Thanks LarryMc - the Mouse Position code works fine.