monoscout999 Posted May 23, 2011 Posted May 23, 2011 Hi forum i am writing a selector tool to use with another program that i´m making to get the pixel raw data of a selected area on the screen... i have problems with the the selector tool i use a GUI with pop up style to do the selection area efect.. and use winmove to resize when i click and drag the mouse.. my problem start when i try to drag from the right to the left or from the bottom to the top, otherwise works fine... here is the code expandcollapse popup#include <misc.au3> #include <WindowsConstants.au3> HotKeySet("{esc}", "_exit") $DLL = DllOpen("user32.dll") Global $pos While 1 $pos = MouseGetPos() If _IsPressed(01, $DLL) Then _drawbox() Sleep(100) WEnd Func _exit() DllClose($DLL) ConsoleWrite("se cerro la dll" & @CRLF) Exit EndFunc ;==>_exit Func _drawbox() Local $hGui = GUICreate("selectionbox", 0, 0, $pos[0], $pos[1], $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x00ff00, $hGui) WinSetTrans($hGui, "", 50) GUISetState() While _IsPressed(01, $DLL) $pos2 = MouseGetPos() Select Case $pos2[0] < 0 WinMove($hGui, "", $pos2[0], $pos[1], $pos[0]-$pos2[0], $pos2[1], 100) Case $pos2[1] < 0 WinMove($hGui, "", $pos[0], $pos2[1], $pos2[0], $pos[1]-$pos2[1], 100) Case $pos2[0] < 0 And $pos2[1] < 0 WinMove($hGui, "", $pos2[0], $pos2[1], $pos[0]-$pos2[0], $pos[1]-$pos2[1], 100) Case Else Opt("MouseCoordMode", 0) WinMove($hGui, "", $pos[0], $pos[1], $pos2[0], $pos2[1], 100) EndSelect WEnd ConsoleWrite("x inicial = " & $pos[0] & " X final = " & $pos2[0] & @CRLF & "y inicial = " & $pos[1] & " y final = " & $pos2[0] & @CRLF) Opt("MouseCoordMode", 1) ; set the mousecoord like before EndFunc ;==>_drawbox Maybe someine can help me and tell me also if there´s other way to do the selectionbox efect
Moderators Melba23 Posted May 23, 2011 Moderators Posted May 23, 2011 monoscout999,I posted a script which uses a "light window" to select an area here - I hope it might be of use. I have a similar version somewhere with an expanding rectangle if you would prefer that. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
monoscout999 Posted May 23, 2011 Author Posted May 23, 2011 (edited) thanks melva just what i look for. what a good trik _WinAPI_SetWindowRgn() you create a inverse region ... EDIT: Also... inmejorable... Edited May 23, 2011 by monoscout999
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now