Results 1 to 2 of 2

Thread: Code snippet: Click to window at client coordinates

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Code snippet: Click to window at client coordinates

    Every man reaches a point in his life, when he needs to... click on specified point in window!

    Here is my proposal for enhancing UI module with such a functionality:
    ' -- Win32
    Begin Const
      %MouseEventF_LeftDown = &H2 
      %MouseEventF_LeftUp   = &H4 
    End Const
    Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
    
    ' -- Functions
    Function Win_ClickAt( hWnd As DWord, x As Long, y As Long )
    
      Win_SetForeground(hWnd)
      
      Dim clickPosition As POINTAPI
      clickPosition.x = x
      clickPosition.y = y
      
      Win_ClientToScreen(hWnd, clickPosition)
      Win_SetCursorPos(clickPosition.x, clickPosition.y)
      mouse_event(%MouseEventF_LeftDown, 0, 0, 0, 0)
      mouse_event(%MouseEventF_LeftUp, 0, 0, 0, 0)  
      
    End Function
    

    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  2. #2
    Quote Originally Posted by Petr Schreiber View Post
    Every man reaches a point in his life, when he needs to... click on specified point in window!

    Mike
    (3.6GHz i5 Core Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, x64 Windows 7 Ultimate Sp1)

Similar Threads

  1. click on a Label
    By zak in forum UI (User Interface)
    Replies: 2
    Last Post: 16-04-2011, 14:49
  2. TCP UPD Example server and client Message
    By Laatwaai in forum Tcp/Udp module
    Replies: 7
    Last Post: 21-08-2010, 13:57
  3. M15 texturing - UV Coordinates
    By dcromley in forum M15 file format
    Replies: 5
    Last Post: 06-04-2009, 08:41

Members who have read this thread: 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •