Jump to content

How to get MousePos from minimized window?


Recommended Posts

I saw that Insolence function for minimized clicking wont work with simple click ( _MouseClickPlus($Window, "right"), cuz this get coord from natural mouse pos, not from minimized mode

Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 1)
    Local $MK_LBUTTON       =  0x0001
    Local $WM_LBUTTONDOWN   =  0x0201
    Local $WM_LBUTTONUP     =  0x0202
    
    Local $MK_RBUTTON       =  0x0002   
    Local $WM_RBUTTONDOWN   =  0x0204
    Local $WM_RBUTTONUP     =  0x0205
 
    Local $WM_MOUSEMOVE     =  0x0200
    
    Local $i                = 0
    
    Select 
    Case $Button = "left"
       $Button     =  $MK_LBUTTON
       $ButtonDown =  $WM_LBUTTONDOWN
       $ButtonUp   =  $WM_LBUTTONUP
    Case $Button = "right"
       $Button     =  $MK_RBUTTON
       $ButtonDown =  $WM_RBUTTONDOWN
       $ButtonUp   =  $WM_RBUTTONUP
    EndSelect
    
    If $X = "" OR $Y = "" Then
       $MouseCoord = MouseGetPos()
       $X = $MouseCoord[0]
       $Y = $MouseCoord[1]
    EndIf
    
    For $i = 1 to $Clicks
       DllCall("user32.dll", "int", "SendMessage", _
          "hwnd",  WinGetHandle( $Window ), _
          "int",   $WM_MOUSEMOVE, _
          "int",   0, _
          "long",  _MakeLong($X, $Y))
          
       DllCall("user32.dll", "int", "SendMessage", _
          "hwnd",  WinGetHandle( $Window ), _
          "int",   $ButtonDown, _
          "int",   $Button, _
          "long",  _MakeLong($X, $Y))
          
       DllCall("user32.dll", "int", "SendMessage", _
          "hwnd",  WinGetHandle( $Window ), _
          "int",   $ButtonUp, _
          "int",   $Button, _
          "long",  _MakeLong($X, $Y))
    Next
EndFunc

i tried to check sth with DLL

Func _MouseGetPos()
        
        DllCall("user32.dll", "int short", "SendMessage", _
        "hwnd", WinGetHandle( $Window ), _
        "int", $GET_X_LPARAM)
        
EndFunc

but big fail

this was inside windowsx.h

#define GET_X_LPARAM(lp)                        ((int)(short)LOWORD(lp))
#define GET_Y_LPARAM(lp)                        ((int)(short)HIWORD(lp))

This DLL functions look very interesting, but I am too low for this, when i dont know basic functions in C++ :|

I think that OPT etc. isnt enought to do this... :blink:

Ah maybe this is required... I am using Win7 Ultimate 32bit

Edited by Sobiech

This world is crazy

Link to comment
Share on other sites

I solved this problem in other style, but this isnt by MousePos

Maybe we can use some functions to get a mouse distance from left, and up line of window? Of from center of window (by ClientGetSize)

I think that there are many ways to do it

This world is crazy

Link to comment
Share on other sites

Im stuggling to understand what you need.

As I understand it, no amount of mouse or pixel functions are going to help you to click a minimized window.

Does ControlClick not work?

not work

Eg. if we get X pixels between left border and mouse, and Y pixels between Top border and mouse, then we have XY of our minimized mouse

Hmm but how to get pixels between left/top border and mouse if we dont know mouse pos? :blink:

This require some asembler skills I think :\

This world is crazy

Link to comment
Share on other sites

All the functionality is there, like your controls and such, but none of it is visually rendered, so there are no pixels.

Think about this: you are at your desktop with a notepad window minimized to the taskbar, can you see your mouse? of course you can because the desktop is not minimized.

When you click something minimized, you are sending a message to a control of the window, your mouse is not in that window.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...