SEKOMD Posted yesterday at 01:08 PM Share Posted yesterday at 01:08 PM (sorry, I use google translator) Is there any way to get rid of the window flickering when resizing? (pull upper left corner) expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Misc.au3> HotKeySet("{ESC}", "_Exit") Local $hGUI = GUICreate("", 400, 400, -1, -1, $WS_POPUP) Local $hLabel = GUICtrlCreateLabel("", 0, 0, 400, 400) Local $aPos = WinGetPos($hGUI) _Hole($hGUI, 20, 20, $aPos[2] - 2 * 20, $aPos[3] - 2 * 20, $aPos[2], $aPos[3]) GUISetBkColor(0x000000) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_PRIMARYDOWN $iX = WinGetPos($hGUI)[0] $iY = WinGetPos($hGUI)[1] $iWidth = WinGetPos($hGUI)[2] $iHeight = WinGetPos($hGUI)[3] $temp_x = MouseGetPos(0)-$iX $temp_y = MouseGetPos(1)-$iY $MouseGetPos_X_Start = MouseGetPos(0) $MouseGetPos_Y_Start = MouseGetPos(1) While _IsPressed('01') $MouseGetPos_X = MouseGetPos(0) $MouseGetPos_Y = MouseGetPos(1) $iWidth_New = ($MouseGetPos_X_Start-$MouseGetPos_X)+$iWidth $iHeight_New = ($MouseGetPos_Y_Start-$MouseGetPos_Y)+$iHeight WinMove($hGUI,'', $MouseGetPos_X-$temp_x, $MouseGetPos_Y-$temp_y, $iWidth_New, $iHeight_New) ;flickering ;======================================================= $aPos = WinGetPos($hGUI) $size = 20 _Hole($hGUI, $size, $size, $aPos[2] - 2 * $size, $aPos[3] - 2 * $size, $aPos[2], $aPos[3]) WEnd ;Drag_Window() EndSwitch WEnd Func _Hole($h_win, $i_x, $i_y, $i_sizew, $i_sizeh, $width, $Height) Local $outer_rgn, $inner_rgn, $combined_rgn $outer_rgn = _WinAPI_CreateRectRgn(0, 0, $width, $Height) $inner_rgn = _WinAPI_CreateRectRgn($i_x, $i_y, $i_x + $i_sizew, $i_y + $i_sizeh) $combined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0) _WinAPI_CombineRgn($combined_rgn, $outer_rgn, $inner_rgn, $RGN_DIFF) _WinAPI_DeleteObject($outer_rgn) _WinAPI_DeleteObject($inner_rgn) _WinAPI_SetWindowRgn($h_win, $combined_rgn) EndFunc ;==>_Hole Func Drag_Window() _SendMessage($hGUI, $WM_SYSCOMMAND, 0xF012, 0) EndFunc Func _Exit() Exit EndFunc ;==>_Exit Link to comment Share on other sites More sharing options...
KaFu Posted yesterday at 01:34 PM Share Posted yesterday at 01:34 PM Add a sleep(10) to the _ispressed loop? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
SEKOMD Posted yesterday at 01:39 PM Author Share Posted yesterday at 01:39 PM 3 minutes ago, KaFu said: Add a sleep(10) to the _ispressed loop? The frame is still blinking. I want to make a frame without content and with the ability to resize. (sorry for English). Link to comment Share on other sites More sharing options...
Nine Posted yesterday at 01:41 PM Share Posted yesterday at 01:41 PM It does not flicker on me (maybe my comp is fast enough), but you could try to use $WS_EX_COMPOSITED in your main GUI creation. See if that helps. “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 Link to comment Share on other sites More sharing options...
SEKOMD Posted yesterday at 01:58 PM Author Share Posted yesterday at 01:58 PM 14 minutes ago, Nine said: It does not flicker on me (maybe my comp is fast enough), but you could try to use $WS_EX_COMPOSITED in your main GUI creation. See if that helps. $WS_EX_COMPOSITED - unfortunately it didn't help ((((( Link to comment Share on other sites More sharing options...
Nine Posted yesterday at 05:33 PM Share Posted yesterday at 05:33 PM (edited) Here my attempt on it (finally saw what you are seeing although it is quite lite on me) : expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Misc.au3> Opt("MustDeclareVars", True) HotKeySet("{ESC}", Terminate) Local $hMainGUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) WinSetTrans($hMainGUI, "", 60) GUISetState() Local $hGUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) Local $nLeft = @DesktopWidth / 2 - 200, $nTop = @DesktopHeight / 2 - 200, $nWidth = 400, $nHeight = 400 Rect($hGUI, $nLeft, $nTop, $nWidth, $nHeight) GUISetBkColor(0x000000) GUISetState() Local $iMouseX, $iMouseY, $iMouseNewX, $iMouseNewY While True Switch GUIGetMsg() Case $GUI_EVENT_PRIMARYDOWN $iMouseX = MouseGetPos(0) $iMouseY = MouseGetPos(1) ; based on mouse pos you should decide what will be the drag type ; only done bottom - right (everywhere) GUISetCursor($MCID_SIZENWSE , $GUI_CURSOR_OVERRIDE, $hMainGUI) While _IsPressed('01') $iMouseNewX = MouseGetPos(0) $iMouseNewY = MouseGetPos(1) ;$nLeft = $iMouseNewX - $iMouseX + $nLeft ;$nTop = $iMouseNewY - $iMouseY + $nTop $nWidth = $iMouseNewX - $iMouseX + $nWidth $nHeight = $iMouseNewY - $iMouseY + $nHeight Rect($hGUI, $nLeft, $nTop, $nWidth, $nHeight) $iMouseX = $iMouseNewX $iMouseY = $iMouseNewY WEnd GUISetCursor() EndSwitch WEnd Func Rect($hWnd, $iX, $iY, $iWidth, $iHeight) Local $hMain = _WinAPI_CreateRectRgn(0, 0, 0, 0) Local $hMask = _WinAPI_CreateRectRgn($iX, $iY, $iX + $iWidth, $iY + $iHeight) _WinAPI_CombineRgn($hMain, $hMask, $hMain, $RGN_OR) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($iX + 5, $iY + 5, $iX + $iWidth - 5, $iY + $iHeight - 5) _WinAPI_CombineRgn($hMain, $hMain, $hMask, $RGN_DIFF) _WinAPI_DeleteObject($hMask) _WinAPI_SetWindowRgn($hWnd, $hMain) EndFunc ;==>Rect Func Terminate() Exit EndFunc ;==>Terminate As mentioned in the script I only done bottom right drag... Edited 22 hours ago by Nine better code SEKOMD 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 Link to comment Share on other sites More sharing options...
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