Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Range of value?

$
0
0
Hi forum,
I have searched, maybe not with the correct word, and i don't have find anything

I wanto to use MouseGetPos() for determinate if the mouse cursor is inside or outside the GUI.
Example:
My Gui is 500 x 200 at the center with -1 -1
My desktop is 800 x 600

So if Mouse X is in a range from > 150 but < 650 and the Mouse Y is etc. is inside GUI
And the same if it is outside

I'm not very good in math and i don't know if this is correct approach, i want to make this with $var and using a simple DLL call like:
[ autoit ]      
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 500, "long", 0x00080000) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 500, "long", 0x00090000)

I have make this but is wrong
[ autoit ]         
#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> Global $DesktopWidth = _WinAPI_GetSystemMetrics(78) Global $DesktopHeight = _WinAPI_GetSystemMetrics(79) Global $Fade = False $Number_Element = 4 $GUI_Height = 100 $GUI_Width = $GUI_Height * $Number_Element $GUIx = (@DesktopWidth / 2) - $GUI_Width / 2 $GUIy = -10 $hGUI = GUICreate("", $GUI_Width, $GUI_Height, $GUIx, $GUIy, BitOR($WS_POPUP, $WS_SYSMENU)) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() $pos = MouseGetPos() Select      Case $nMsg = $GUI_EVENT_CLOSE          Exit      Case $pos[0] "???" And Not $Fade          $Fade = True          DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hGUI, "int", 500, "long", 0x00080000)      Case $pos[0] "???" And $Fade          $Fade = False          DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hGUI, "int", 500, "long", 0x00090000) EndSelect WEnd

a little help? :D

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>