Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

cursor position !


  • Please log in to reply
9 replies to this topic

#1 FinishHim

FinishHim

    Adventurer

  • Active Members
  • PipPip
  • 129 posts

Posted 16 July 2013 - 02:54 PM

Gets the mouse cursor position relative to CONTROL ? 

 

Edited by Mrbenkali, 16 July 2013 - 03:20 PM.


My next project in Autoit  " Autoit Total Control Beta 0.1 "
Thank You Autoit  :)







#2 FireFox

FireFox

    It slips through our fingers, like a fist full of sand.

  • MVPs
  • 5,382 posts

Posted 16 July 2013 - 02:58 PM

Hi,

Yes you can, think a little.


OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.

Hardware : Intel® Core™ i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 07 November, 2013 - If you find dead links please send me a PM, do not post in the topics !


#3 FinishHim

FinishHim

    Adventurer

  • Active Members
  • PipPip
  • 129 posts

Posted 16 July 2013 - 03:02 PM

you can do it in my example !



My next project in Autoit  " Autoit Total Control Beta 0.1 "
Thank You Autoit  :)

#4 FireFox

FireFox

    It slips through our fingers, like a fist full of sand.

  • MVPs
  • 5,382 posts

Posted 16 July 2013 - 03:10 PM

you can do it in my example !

:blink:


OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.

Hardware : Intel® Core™ i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 07 November, 2013 - If you find dead links please send me a PM, do not post in the topics !


#5 FireFox

FireFox

    It slips through our fingers, like a fist full of sand.

  • MVPs
  • 5,382 posts

Posted 16 July 2013 - 03:16 PM

Hints: Ctrl coords, Mouse coords; Difference.


Edited by FireFox, 16 July 2013 - 03:17 PM.

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.

Hardware : Intel® Core™ i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 07 November, 2013 - If you find dead links please send me a PM, do not post in the topics !


#6 FinishHim

FinishHim

    Adventurer

  • Active Members
  • PipPip
  • 129 posts

Posted 16 July 2013 - 03:19 PM

How to do in this example 

AutoIt         
#include <GUIConstantsEx.au3> Global $x, $y Example() Func Example()     Local $msg     HotKeySet("{Esc}", "GetPos")     GUICreate("Press Esc to Get Pos", 400, 400)     $x = GUICtrlCreateLabel("0", 10, 10, 50)     $y = GUICtrlCreateLabel("0", 10, 30, 50)     $Pic1 = GUICtrlCreatePic("", 10, 40, 250, 250)     GUISetState()     ; Run the GUI until the dialog is closed     Do         $msg = GUIGetMsg()     Until $msg = $GUI_EVENT_CLOSE EndFunc   ;==>Example Func GetPos()     Local $a     $a = GUIGetCursorInfo($Pic1)     GUICtrlSetData($x, $a[0])     GUICtrlSetData($y, $a[1]) EndFunc   ;==>GetPos


My next project in Autoit  " Autoit Total Control Beta 0.1 "
Thank You Autoit  :)

#7 FireFox

FireFox

    It slips through our fingers, like a fist full of sand.

  • MVPs
  • 5,382 posts

Posted 16 July 2013 - 03:21 PM

You're losing more time to post than to find how to do it knowing that I almost did it for you (without code).


Edited by FireFox, 16 July 2013 - 03:22 PM.

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.

Hardware : Intel® Core™ i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 07 November, 2013 - If you find dead links please send me a PM, do not post in the topics !


#8 DW1

DW1

    Central Scrutinizer

  • Active Members
  • PipPipPipPipPipPip
  • 2,107 posts

Posted 16 July 2013 - 03:24 PM

FireFox already told you.

You already know the coordinates of the control.  You know how to get the coordinates of the mouse.  The rest is arithmetic.



#9 FireFox

FireFox

    It slips through our fingers, like a fist full of sand.

  • MVPs
  • 5,382 posts

Posted 16 July 2013 - 03:33 PM

Result: You don't even need to get the cursor coords (with the MouseGetPos function).

 

That was quite hard.

AutoIt         
#include <GUIConstantsEx.au3>   Local $hGUI = 0, $iLabel1 = 0, $aCi = 0, $aCtrlPos = 0   $hGUI = GUICreate("MyGUI")   $iLabel1 = GUICtrlCreateLabel("", 10, 10, 100, 13)   GUISetState(@SW_SHOW, $hGUI)   $aCtrlPos = ControlGetPos($hGUI, "", $iLabel1) ;in case you don't know the control coords   While GUIGetMsg() <> $GUI_EVENT_CLOSE     Sleep(10)       $aCi = GUIGetCursorInfo($hGUI)     If IsArray($aCi) = 0 Then ContinueLoop       GUICtrlSetData($iLabel1, "X: " & $aCi[0] - $aCtrlPos[0] & ", Y: " & $aCi[1] - $aCtrlPos[1]) WEnd   GUIDelete($hGUI)

Edited by FireFox, 16 July 2013 - 03:34 PM.

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.

Hardware : Intel® Core™ i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 07 November, 2013 - If you find dead links please send me a PM, do not post in the topics !


#10 FinishHim

FinishHim

    Adventurer

  • Active Members
  • PipPip
  • 129 posts

Posted 16 July 2013 - 04:29 PM

AH OK THANK YOU 

FireFox   :thumbsup: 

My next project in Autoit  " Autoit Total Control Beta 0.1 "
Thank You Autoit  :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users