Mausklicks usw.

Hier könnt Ihr gute, von Euch geschriebene Codes posten. Sie müssen auf jeden Fall funktionieren und sollten möglichst effizient, elegant und beispielhaft oder einfach nur cool sein.
Benutzeravatar
cxAlex
Beiträge: 2111
Registriert: 26.06.2008 10:42

Mausklicks usw.

Beitrag von cxAlex »

Weils immer wieder gefragt wird hier ein paar Proceduren um Mausklicks systemweit zu simulieren:

Code: Alles auswählen

Procedure Left_Click()
  Protected xy.point
  GetCursorPos_(xy.point)
  mouse_event_(#MOUSEEVENTF_LEFTDOWN, xy\x, xy\y, 0, 0)
  mouse_event_(#MOUSEEVENTF_LEFTUP, xy\x, xy\y, 0, 0)
EndProcedure

Procedure Left_DoubleClick()
  Protected xy.point
  GetCursorPos_(xy.point)
  mouse_event_(#MOUSEEVENTF_LEFTDOWN, xy\x, xy\y, 0, 0)
  mouse_event_(#MOUSEEVENTF_LEFTUP, xy\x, xy\y, 0, 0)
  mouse_event_(#MOUSEEVENTF_LEFTDOWN, xy\x, xy\y, 0, 0)
  mouse_event_(#MOUSEEVENTF_LEFTUP, xy\x, xy\y, 0, 0)
EndProcedure

Procedure Right_Click()
  Protected xy.point
  GetCursorPos_(xy.point)
  mouse_event_(#MOUSEEVENTF_RIGHTDOWN, xy\x, xy\y, 0, 0)
  mouse_event_(#MOUSEEVENTF_RIGHTUP, xy\x, xy\y, 0, 0)
EndProcedure

Procedure Right_DoubleClick()
  Protected xy.point
  GetCursorPos_(xy.point)
  mouse_event_(#MOUSEEVENTF_RIGHTDOWN, xy\x, xy\y, 0, 0)
  mouse_event_(#MOUSEEVENTF_RIGHTUP, xy\x, xy\y, 0, 0)
  mouse_event_(#MOUSEEVENTF_RIGHTDOWN, xy\x, xy\y, 0, 0)
  mouse_event_(#MOUSEEVENTF_RIGHTUP, xy\x, xy\y, 0, 0)
EndProcedure

Procedure Middle_Click()
  Protected xy.point
  GetCursorPos_(xy.point)
  mouse_event_(#MOUSEEVENTF_MIDDLEDOWN, xy\x, xy\y, 0, 0)
  mouse_event_(#MOUSEEVENTF_MIDDLEUP, xy\x, xy\y, 0, 0)
EndProcedure

Procedure Middle_DoubleClick()
  Protected xy.point
  GetCursorPos_(xy.point)
  mouse_event_(#MOUSEEVENTF_MIDDLEDOWN, xy\x, xy\y, 0, 0)
  mouse_event_(#MOUSEEVENTF_MIDDLEUP, xy\x, xy\y, 0, 0)
  mouse_event_(#MOUSEEVENTF_MIDDLEDOWN, xy\x, xy\y, 0, 0)
  mouse_event_(#MOUSEEVENTF_MIDDLEUP, xy\x, xy\y, 0, 0)
EndProcedure
Projekte: IO.pbi, vcpu
Pausierte Projekte: Easy Network Manager, µC Emulator
Aufgegebene Projekte: ECluster

Bild

PB 5.1 x64/x86; OS: Win7 x64/Ubuntu 10.x x86
Andesdaf
Moderator
Beiträge: 2671
Registriert: 15.06.2008 18:22
Wohnort: Dresden

Beitrag von Andesdaf »

schick :D
Win11 x64 | PB 6.20
Antworten