peut on deplacer le pointeur de la souris logiciellement ? Si oui, comment ?
Je sais aussi qu'on peux simuler le clic de la souris.
Je n'ai pas voulu deterrer un vieux post meme plus valable avec nos 5.70
Merci

Hoooo, c'est exactement caGallyHC a écrit :Bonjour SPH,
Je penses que tu recherches "SetCursorPos_(x, y)".
Cordialement,
GallyHC
Code : Tout sélectionner
mouse_event_(#MOUSEEVENTF_LEFTUP,200,180,0,1)
mouse_event_(#MOUSEEVENTF_LEFTDOWN,200,180,0,1)
Code : Tout sélectionner
Global lpPoint.Point
Procedure LeftClick()
GetCursorPos_(lpPoint)
Debug "Cible : "+lpPoint\x+", "+lpPoint\y+" Click Gauche"
mouse_event_(#MOUSEEVENTF_LEFTDOWN,0,0,0,0)
mouse_event_(#MOUSEEVENTF_LEFTUP,0,0,0,0)
EndProcedure
Procedure RightClick()
GetCursorPos_(lpPoint)
Debug "Cible : "+lpPoint\x+", "+lpPoint\y+" Click Droit"
mouse_event_(#MOUSEEVENTF_RIGHTDOWN,0,0,0,0)
mouse_event_(#MOUSEEVENTF_RIGHTUP,0,0,0,0)
EndProcedure
Procedure Target(X.i, Y.i, Button.i=0 ) ; Button = 0 (Pas de Click), Button = 1 (LeftClick), Button = 2 (RightClick)
Protected Xa.d, Ya.d, Xb.d, Yb.d, DeplacX.d, DeplacY.d, Dx.i, DY.i
GetCursorPos_(lpPoint)
Debug "Depart : "+lpPoint\x+", "+lpPoint\y
Xa = lpPoint\x
Ya = lpPoint\y
Xb=X
Yb = Y
Dx = Pow(Xa - Xb, 2)
Dy = Pow(Ya - Yb, 2)
If Dx >= Dy
If Xa <= Xb
DeplacX = Xb - Xa
DeplacY = (Yb - Ya) / DeplacX
Repeat
SetCursorPos_(Xa, Ya)
Xa+1 : Ya + DeplacY
Delay(2)
WindowEvent()
Until Xa >= Xb
Else
DeplacX = Xa - Xb
DeplacY = (Yb - Ya) / DeplacX
Repeat
SetCursorPos_(Xa, Ya)
Xa-1 : Ya + DeplacY
Delay(2)
WindowEvent()
Until Xa <= Xb
EndIf
Else
If Ya <= Yb
DeplacY = Yb - Ya
DeplacX = (Xb - Xa) / DeplacY
Repeat
SetCursorPos_(Xa, Ya)
Ya+1 : Xa + DeplacX
Delay(2)
WindowEvent()
Until Ya >= Yb
Else
DeplacY = Ya - Yb
DeplacX = (Xb - Xa) / DeplacY
Repeat
SetCursorPos_(Xa, Ya)
Ya-1 : Xa + DeplacX
Delay(2)
WindowEvent()
Until Ya <= Yb
EndIf
EndIf
If button = 1 : LeftClick() : EndIf
If Button = 2 : RightClick() : EndIf
EndProcedure
OpenWindow(0,0,0,400,400,"Test Mouse", #PB_Window_SystemMenu)
Target(390,5,1) ; Position bouton fermeture window
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow