Ooops
November 28, 2020, 01:59:40 PM

Author Topic: [bmx] Mouse commands by JoshK [ 1+ years ago ]  (Read 485 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bmx] Mouse commands by JoshK [ 1+ years ago ]
« on: June 29, 2017, 12:28:39 AM »
Title : Mouse commands
Author : JoshK
Posted : 1+ years ago

Description : Replacement mouse commands for gadget mouse coordinates.

Code :
Code: BlitzMax
  1. SuperStrict
  2.  
  3. Import maxgui.maxgui
  4. Import pub.win32
  5.  
  6. Private
  7.  
  8. ?win32
  9. Extern "win32"
  10.         Function GetCursorPos:Int(point:Byte Ptr)
  11.         Function SetCursorPos:Int(x:Int,y:Int)
  12.         Function ScreenToClient:Int(hwnd:Int,point:Byte Ptr)
  13. EndExtern
  14. ?
  15.  
  16. Public
  17.  
  18. Function MouseX:Int(gadget:TGadget=Null)
  19.         Local hwnd:Int
  20.         Local pos:Int[2]
  21.         GetCursorPos pos
  22.         If gadget screentoclient QueryGadget(gadget,QUERY_HWND),pos
  23.         Return pos[0]  
  24. EndFunction
  25.  
  26. Function MouseY:Int(gadget:TGadget=Null)
  27.         Local hwnd:Int
  28.         Local pos:Int[2]
  29.         GetCursorPos pos
  30.         If gadget screentoclient QueryGadget(gadget,QUERY_HWND),pos
  31.         Return pos[1]  
  32. EndFunction
  33.  
  34. Function MoveMouse(x:Int,y:Int,gadget:TGadget=Null)
  35.         Local hwnd:Int
  36.         Local pos:Int[2]
  37.         pos[0]=x
  38.         pos[1]=y
  39.         If gadget clienttoscreen QueryGadget(gadget,QUERY_HWND),pos
  40.         SetCursorPos pos[0],pos[1]
  41. EndFunction


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal