Date: 02-16-2022
Return to Index
created by gbSnippets
'Sets the cursor's position, in screen coordinates.
'Primary Code:
Dim P as Point
SetCursorPos x,y 'x and y are in screen coordinates
'Compilable Example: (Jose Includes)
'This examples sets the screen coordinates of (200,200)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"Set Cursor Position", 50,10,100,20
SetTimer(hDlg, 200, 50, 0) 'creates the timer 200ms
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If CB.Msg = %WM_Command AND CB.Ctl = 100 AND CB.Ctlmsg = %BN_Clicked Then
Local x as Integer, y as Integer
x = 200 : y = 200
SetCursorPos x,y 'x and y are in screen coordinates
End If
End Function
'gbs_00031
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm