SEKOMD Posted January 28 Posted January 28 (edited) Hello everyone!!! I'll tell you right away - most likely my task is impossible to solve. However, perhaps I will be lucky. Is there any way to move or change the position of an already created region? is this impossible or maybe I don't know something? I mean changing the location of a region (new x y) that has already been created. It seems unrealistic. But it would be cool!! expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WinAPIHObj.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WinAPIHObj.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> $hGUI = GUICreate('Move region - is it possible.. ?', 600, 600) GUISetBkColor($COLOR_RED, $hGUI) GUISetState(@SW_SHOW, $hGUI) Global $x = 0, $y = 0, $iWidth = 80, $iHeight = 80 $hRgn1 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) Global $x = 120, $y = 120, $iWidth = 80, $iHeight = 80 $hRgn2 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) $hCombinedRgn = _WinAPI_CreateRectRgn(0, 0, WinGetPos($hGUI)[2], WinGetPos($hGUI)[3]) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn1, 1) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn2, 3) ;help me ;how to move region? ;ex. _WinAPI_MoveRgn ... (set new iX iY) ;ex. _WinAPI_RgnSetPos ... (set new iX iY) ;any ideas? _WinAPI_SetWindowRgn($hGUI, $hCombinedRgn) _WinAPI_DeleteObject($hRgn1) _WinAPI_DeleteObject($hCombinedRgn) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Sorry for my English! Edited January 28 by SEKOMD
ioa747 Posted January 28 Posted January 28 (edited) expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WinAPIHObj.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> Global $hGUI = GUICreate('Move region - is it possible.. ?', 600, 600) GUISetBkColor($COLOR_RED, $hGUI) GUISetState(@SW_SHOW, $hGUI) Global $x = 0, $y = 0, $iWidth = 80, $iHeight = 80 Global $hRgn1 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) $x = 120 $y = 120 Global $hRgn2 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) Global $hCombinedRgn = _WinAPI_CreateRectRgn(0, 0, WinGetPos($hGUI)[2], WinGetPos($hGUI)[3]) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn1, 1) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn2, 3) _WinAPI_SetWindowRgn($hGUI, $hCombinedRgn) Sleep(3000) ; Move the first region to (50, 50) $x = 50 ; New X position $y = 50 ; New Y position $hRgn1 = MoveRegion($hRgn1, $x, $y) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Clean up _WinAPI_DeleteObject($hRgn1) _WinAPI_DeleteObject($hRgn2) GUIDelete($hGUI) ;--------------------------------------------------------------------------------------- Func MoveRegion($hRegion, $newX, $newY) Local $hNewRgn = _WinAPI_CreateRectRgn($newX, $newY, $newX + $iWidth, $newY + $iHeight) Local $hNewCombinedRgn = _WinAPI_CreateRectRgn(0, 0, WinGetPos($hGUI)[2], WinGetPos($hGUI)[3]) _WinAPI_CombineRgn($hNewCombinedRgn, $hNewCombinedRgn, $hNewRgn, 1) _WinAPI_CombineRgn($hNewCombinedRgn, $hNewCombinedRgn, $hRgn2, 3) ; Keep the second region _WinAPI_SetWindowRgn($hGUI, $hNewCombinedRgn) _WinAPI_DeleteObject($hRegion) _WinAPI_DeleteObject($hNewCombinedRgn) Return $hNewRgn EndFunc ;--------------------------------------------------------------------------------------- Edited January 28 by ioa747 corrections SEKOMD 1 I know that I know nothing
SEKOMD Posted January 28 Author Posted January 28 6 minutes ago, ioa747 said: expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WinAPIHObj.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> $hGUI = GUICreate('Move region - is it possible.. ?', 600, 600) GUISetBkColor($COLOR_RED, $hGUI) GUISetState(@SW_SHOW, $hGUI) Global $x = 0, $y = 0, $iWidth = 80, $iHeight = 80 $hRgn1 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) Global $x = 120, $y = 120, $iWidth = 80, $iHeight = 80 $hRgn2 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) Global $hCombinedRgn = _WinAPI_CreateRectRgn(0, 0, WinGetPos($hGUI)[2], WinGetPos($hGUI)[3]) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn1, 1) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn2, 3) _WinAPI_SetWindowRgn($hGUI, $hCombinedRgn) Sleep(3000) ; Move the first region to (50, 50) $x1 = 50 ; New X position $y1 = 50 ; New Y position $hRgn1 = MoveRegion($hRgn1, $x1, $y1) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Clean up _WinAPI_DeleteObject($hRgn1) _WinAPI_DeleteObject($hRgn2) GUIDelete($hGUI) ;--------------------------------------------------------------------------------------- Func MoveRegion($hRegion, $newX, $newY) Local $hNewRgn = _WinAPI_CreateRectRgn($newX, $newY, $newX + $iWidth, $newY + $iHeight) Local $hNewCombinedRgn = _WinAPI_CreateRectRgn(0, 0, WinGetPos($hGUI)[2], WinGetPos($hGUI)[3]) _WinAPI_CombineRgn($hNewCombinedRgn, $hNewCombinedRgn, $hNewRgn, 1) _WinAPI_CombineRgn($hNewCombinedRgn, $hNewCombinedRgn, $hRgn2, 3) ; Keep the second region _WinAPI_SetWindowRgn($hGUI, $hNewCombinedRgn) _WinAPI_DeleteObject($hRegion) _WinAPI_DeleteObject($hNewCombinedRgn) Return $hNewRgn EndFunc ;--------------------------------------------------------------------------------------- yes, I can do that too, thank you for the useful example. But what I mean is to transfer the already created region.. I just don't think it is possible. But maybe I'm wrong?
ioa747 Posted January 28 Posted January 28 I know so far. Wait for someone more advanced. I know that I know nothing
SEKOMD Posted January 28 Author Posted January 28 2 minutes ago, ioa747 said: I know so far. Wait for someone more advanced. the thing is that this is not just moving a region, it is... moving a part of the window interface, which is a single whole..
Nine Posted January 28 Posted January 28 Maybe this ? #include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <ColorConstants.au3> $hGUI = GUICreate('Move region - is it possible.. ?', 600, 600) GUISetBkColor($COLOR_RED, $hGUI) GUISetState(@SW_SHOW, $hGUI) Global $x = 30, $y = 30, $iWidth = 80, $iHeight = 80 $hRgn1 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) Global $x = 120, $y = 120, $iWidth = 80, $iHeight = 80 $hRgn2 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) $hCombinedRgn = _WinAPI_CreateRectRgn(0, 0, WinGetPos($hGUI)[2], WinGetPos($hGUI)[3]) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn1, 1) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn2, 3) _WinAPI_OffsetRgn($hCombinedRgn, +200, +200) _WinAPI_SetWindowRgn($hGUI, $hCombinedRgn) _WinAPI_DeleteObject($hRgn1) _WinAPI_DeleteObject($hCombinedRgn) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
SEKOMD Posted January 28 Author Posted January 28 9 minutes ago, Nine said: _WinAPI_OffsetRgn($hCombinedRgn, +200, +200) But the contents also change. But to move it along with a part of the window... Do you need to somehow "cut off" a part of the window?
Nine Posted January 28 Posted January 28 Sorry I don't understand what you mean. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
SEKOMD Posted January 28 Author Posted January 28 3 minutes ago, Nine said: Sorry I don't understand what you mean. Sorry for my English!!!
junkew Posted January 28 Posted January 28 Maybe invalidating the region? Win32 api example // Move the region OffsetRgn(hRegion, x - (x - 10), y - (y - 10)); InvalidateRect(hwnd, NULL, TRUE); // Request a redraw FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
SEKOMD Posted January 28 Author Posted January 28 12 minutes ago, junkew said: Maybe invalidating the region? Win32 api example in theory it is possible, but it is not exactly what is needed I just wanted to move part of the interface.. which will continue to work, react to clicks..
UEZ Posted January 28 Posted January 28 Something like that? expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WinAPIHObj.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WinAPIHObj.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <Timers.au3> $hGUI = GUICreate('Move region - is it possible.. ?', 600, 600) GUISetBkColor($COLOR_RED, $hGUI) GUISetState(@SW_SHOW, $hGUI) Global $x = 0, $y = 0, $iWidth = 80, $iHeight = 80 $hRgn1 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) Global $x = 120, $y = 120, $iWidth = 80, $iHeight = 80 $hRgn2 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) $hCombinedRgn = _WinAPI_CreateRectRgn(0, 0, WinGetPos($hGUI)[2], WinGetPos($hGUI)[3]) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn1, 1) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn2, 3) _WinAPI_SetWindowRgn($hGUI, $hCombinedRgn) ;help me ;how to move region? ;ex. _WinAPI_MoveRgn ... (set new iX iY) ;ex. _WinAPI_RgnSetPos ... (set new iX iY) ;any ideas? Global $i, $tPAINTSTRUCT _Timer_SetTimer($hGUI, 10, "UpdateRegion") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _Timer_KillAllTimers($hGUI) _WinAPI_DeleteObject($hRgn1) _WinAPI_DeleteObject($hRgn2) _WinAPI_DeleteObject($hCombinedRgn) ExitLoop EndSwitch WEnd Func UpdateRegion($hWnd, $iMsg, $iIDTimer, $iTime) #forceref $hWnd, $iMsg, $iIDTimer, $iTime _WinAPI_OffsetRgn($hRgn2, Sin($i) * 10, Cos($i) * 10) $i += 0.1 $hCombinedRgn = _WinAPI_CreateRectRgn(0, 0, WinGetPos($hGUI)[2], WinGetPos($hGUI)[3]) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn1, 1) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn2, 3) _WinAPI_SetWindowRgn($hGUI, $hCombinedRgn) _WinAPI_DeleteObject($hCombinedRgn) EndFunc SEKOMD 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
SEKOMD Posted January 28 Author Posted January 28 40 minutes ago, UEZ said: Something like that? excuse me please, I'm probably explaining something incorrectly the point is to move the region together with the content (without changing it), and to grab it together.. and for this content to be active (in terms of the interface). For now it seems impossible to me. sorry my English..
Nine Posted January 28 Posted January 28 Alright one last attempt : expandcollapse popup#include <GUIConstants.au3> #include <WinAPIGdi.au3> #include <ColorConstants.au3> Example() Func Example() Local $hGUI1 = GUICreate('Move region 1', 300, 300, 300, 200, -1, $WS_EX_CONTROLPARENT) GUISetBkColor($COLOR_RED) GUISetState() Local $hRgn1 = _WinAPI_CreateRectRgn(0, 0, 80, 80) _WinAPI_SetWindowRgn($hGUI1, $hRgn1) Local $hGUI2 = GUICreate('Move region 2', 300, 300, 420, 320, -1, $WS_EX_CONTROLPARENT) GUISetBkColor($COLOR_RED, $hGUI2) GUISetState(@SW_SHOW, $hGUI2) $hRgn2 = _WinAPI_CreateRectRgn(30, 30, 110, 110) _WinAPI_SetWindowRgn($hGUI2, $hRgn2) Sleep(2000) WinMove($hGUI1, "", 500, 500) _WinAPI_DeleteObject($hRgn1) _WinAPI_DeleteObject($hRgn2) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Example You can also drag each square (button ?) independently... SEKOMD and ioa747 1 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
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