mpower Posted February 3, 2014 Share Posted February 3, 2014 (edited) Hi I am trying to have a gui with a listview that automatically resizes with the gui (including column width based on % of gui size). I've been able to achieve this but there is an incessant flickering which I cannot seem to get rid of Any solution? Reproducer: expandcollapse popup#Include <GuiListView.au3> #Include <WindowsConstants.au3> #Include <GUIConstantsEx.au3> $maingui = GUICreate('Test', @DesktopWidth/2, @DesktopHeight/2, @DesktopWidth/2 - (@DesktopWidth/2)/2, @DesktopHeight/2 - (@DesktopHeight/2)/2, _ BitOR($WS_SIZEBOX,$WS_TABSTOP,$WS_MINIMIZEBOX)) $maingui_lv = GUICtrlCreateListView('Col 1|Col 2|Col 3|Col 4|Col 5|Col 6|Col 7|Col 8|Col 9', 0, 0, @DesktopWidth/2, @DesktopHeight/2 - 23, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($maingui_lv, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES)) GUICtrlSetResizing($maingui_lv, $GUI_DOCKBORDERS) ;Generate some random data For $i = 0 To 100 GUICtrlCreateListViewItem( _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) , $maingui_lv) Next GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState() While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $maingui Switch $msg[0] Case $GUI_EVENT_CLOSE Exit EndSwitch EndSwitch WEnd Func WM_SIZE($hWnd, $Msg, $wParam, $lParam) Local $iHeight, $iWidth $iWidth = BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord $iHeight = BitShift($lParam, 16) ; _WinAPI_HiWord GuiSetState(@SW_LOCK, $maingui) _GUICtrlListView_SetColumnWidth($maingui_lv, 0, ($iWidth-17)*0.20) _GUICtrlListView_SetColumnWidth($maingui_lv, 1, ($iWidth-17)*0.30) _GUICtrlListView_SetColumnWidth($maingui_lv, 2, ($iWidth-17)*0.03) _GUICtrlListView_SetColumnWidth($maingui_lv, 3, ($iWidth-17)*0.08) _GUICtrlListView_SetColumnWidth($maingui_lv, 4, ($iWidth-17)*0.07) _GUICtrlListView_SetColumnWidth($maingui_lv, 5, ($iWidth-17)*0.07) _GUICtrlListView_SetColumnWidth($maingui_lv, 6, ($iWidth-17)*0.10) _GUICtrlListView_SetColumnWidth($maingui_lv, 7, ($iWidth-17)*0.10) _GUICtrlListView_SetColumnWidth($maingui_lv, 8, ($iWidth-17)*0.05) GuiSetState(@SW_UNLOCK, $maingui) Return $GUI_RUNDEFMSG EndFunc Edited February 3, 2014 by mpower RichardL 1 Link to comment Share on other sites More sharing options...
mpower Posted February 4, 2014 Author Share Posted February 4, 2014 Any ideas? I've tried a few things and have searched around google and most people fix the flicker in other application that rely on windows listviews by enabling double buffering, which clearly I've done via the extended style, but this doesnt appear to fix the flickering Link to comment Share on other sites More sharing options...
AZJIO Posted February 4, 2014 Share Posted February 4, 2014 (edited) expandcollapse popup#include <GuiListView.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> $maingui = GUICreate('Test', @DesktopWidth / 2, @DesktopHeight / 2, @DesktopWidth / 2 - (@DesktopWidth / 2) / 2, @DesktopHeight / 2 - (@DesktopHeight / 2) / 2, $WS_OVERLAPPEDWINDOW + $WS_POPUP + $WS_CLIPCHILDREN) $maingui_lv = _GUICtrlListView_Create($maingui, ' ', 0, 0, @DesktopWidth / 2, @DesktopHeight / 2 - 23, BitOR($LVS_NOCOLUMNHEADER, $LVS_REPORT, $LVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE + $WS_EX_COMPOSITED, True) _GUICtrlListView_SetExtendedListViewStyle($maingui_lv, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_INFOTIP, $LVS_EX_GRIDLINES)) For $i = 0 To 8 _GUICtrlListView_InsertColumn($maingui_lv, $i, "Col " & $i + 1) Next _GUICtrlListView_BeginUpdate($maingui_lv) For $i = 0 To 100 $idx = _GUICtrlListView_AddItem($maingui_lv, Random(0, 1000000, 1)) For $j = 1 To 8 _GUICtrlListView_AddSubItem($maingui_lv, $idx, Random(0, 1000000, 1), $j) Next Next _GUICtrlListView_EndUpdate($maingui_lv) GUISetState() GUIRegisterMsg($WM_SIZE, "WM_SIZE") While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit EndSwitch WEnd Func WM_SIZE($hWnd, $msg, $wParam, $lParam) Local $iHeight, $iWidth $iWidth = BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord $iHeight = BitShift($lParam, 16) ; _WinAPI_HiWord ; GuiSetState(@SW_LOCK, $maingui) _GUICtrlListView_SetColumnWidth($maingui_lv, 0, ($iWidth - 17) * 0.20) _GUICtrlListView_SetColumnWidth($maingui_lv, 1, ($iWidth - 17) * 0.30) _GUICtrlListView_SetColumnWidth($maingui_lv, 2, ($iWidth - 17) * 0.03) _GUICtrlListView_SetColumnWidth($maingui_lv, 3, ($iWidth - 17) * 0.08) _GUICtrlListView_SetColumnWidth($maingui_lv, 4, ($iWidth - 17) * 0.07) _GUICtrlListView_SetColumnWidth($maingui_lv, 5, ($iWidth - 17) * 0.07) _GUICtrlListView_SetColumnWidth($maingui_lv, 6, ($iWidth - 17) * 0.10) _GUICtrlListView_SetColumnWidth($maingui_lv, 7, ($iWidth - 17) * 0.10) _GUICtrlListView_SetColumnWidth($maingui_lv, 8, ($iWidth - 17) * 0.05) _WinAPI_MoveWindow($maingui_lv, 0, 0, $iWidth, $iHeight - 23) ; GuiSetState(@SW_UNLOCK, $maingui) Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Edited February 4, 2014 by AZJIO My other projects or all Link to comment Share on other sites More sharing options...
mpower Posted February 6, 2014 Author Share Posted February 6, 2014 Thanks for your response AZJIO but that doesn't really work either, I require the column headers. Also with your approach instead of flickering it now lags badly on resize... Link to comment Share on other sites More sharing options...
mpower Posted February 6, 2014 Author Share Posted February 6, 2014 Would anyone else like to take a crack? I would imagine there is some way to get around the flickering issue, but I have yet to discover it. Any veterans know a way? Link to comment Share on other sites More sharing options...
mpower Posted February 12, 2014 Author Share Posted February 12, 2014 Is there really no solution here? Safe to assume that this is an inherent flaw in Autoit and cannot be circumvented? Link to comment Share on other sites More sharing options...
mpower Posted February 18, 2014 Author Share Posted February 18, 2014 bummer Link to comment Share on other sites More sharing options...
FireFox Posted February 18, 2014 Share Posted February 18, 2014 This would be the flawless way to do it : expandcollapse popup#include <GuiListView.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Global $iWidth = 0, $iHeight = 0 $maingui = GUICreate('Test', @DesktopWidth / 2, @DesktopHeight / 2, @DesktopWidth / 2 - (@DesktopWidth / 2) / 2, @DesktopHeight / 2 - (@DesktopHeight / 2) / 2, _ BitOR($WS_SIZEBOX, $WS_TABSTOP, $WS_MINIMIZEBOX)) $maingui_lv = GUICtrlCreateListView('Col 1|Col 2|Col 3|Col 4|Col 5|Col 6|Col 7|Col 8|Col 9', 0, 0, @DesktopWidth / 2, @DesktopHeight / 2 - 23, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($maingui_lv, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES)) GUICtrlSetResizing($maingui_lv, $GUI_DOCKBORDERS) ;Generate some random data For $i = 0 To 100 GUICtrlCreateListViewItem( _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1), $maingui_lv) Next GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE") GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE") GUISetState() While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $maingui Switch $msg[0] Case $GUI_EVENT_CLOSE Exit EndSwitch EndSwitch WEnd Func WM_SIZE($hWnd, $msg, $wParam, $lParam) $iWidth = BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord $iHeight = BitShift($lParam, 16) ; _WinAPI_HiWord EndFunc ;==>WM_SIZE Func WM_ENTERSIZEMOVE($hWnd, $msg, $wParam, $lParam) _GUICtrlListView_BeginUpdate(GUICtrlGetHandle($maingui_lv)) EndFunc ;==>WM_ENTERSIZEMOVE Func WM_EXITSIZEMOVE($hWnd, $msg, $wParam, $lParam) _GUICtrlListView_SetColumnWidth($maingui_lv, 0, ($iWidth - 17) * 0.20) _GUICtrlListView_SetColumnWidth($maingui_lv, 1, ($iWidth - 17) * 0.30) _GUICtrlListView_SetColumnWidth($maingui_lv, 2, ($iWidth - 17) * 0.03) _GUICtrlListView_SetColumnWidth($maingui_lv, 3, ($iWidth - 17) * 0.08) _GUICtrlListView_SetColumnWidth($maingui_lv, 4, ($iWidth - 17) * 0.07) _GUICtrlListView_SetColumnWidth($maingui_lv, 5, ($iWidth - 17) * 0.07) _GUICtrlListView_SetColumnWidth($maingui_lv, 6, ($iWidth - 17) * 0.10) _GUICtrlListView_SetColumnWidth($maingui_lv, 7, ($iWidth - 17) * 0.10) _GUICtrlListView_SetColumnWidth($maingui_lv, 8, ($iWidth - 17) * 0.05) _GUICtrlListView_EndUpdate(GUICtrlGetHandle($maingui_lv)) Return $GUI_RUNDEFMSG EndFunc ;==>WM_EXITSIZEMOVE Note: There is not way to avoid this "flickering", it's the repainting which causes this effect. If you want to alternatively show the listview during resize you can either set a short idle timer on resizing OR repaint every X pixels. Br, FireFox. Link to comment Share on other sites More sharing options...
mpower Posted February 20, 2014 Author Share Posted February 20, 2014 Thanks FireFox! That works better than I anticipated! Are you able to elaborate on the two options here: "If you want to alternatively show the listview during resize you can either set a short idle timer on resizing OR repaint every X pixels."? Perhaps with an example? Sorry I don't understand where to make changes to the code to try the two alternative options where the listview can be shown during resize. Link to comment Share on other sites More sharing options...
FireFox Posted February 21, 2014 Share Posted February 21, 2014 (edited) Test1 : expandcollapse popup#include <GuiListView.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Global $iWidth = 0, $iHeight = 0 $maingui = GUICreate('Test', @DesktopWidth / 2, @DesktopHeight / 2, @DesktopWidth / 2 - (@DesktopWidth / 2) / 2, @DesktopHeight / 2 - (@DesktopHeight / 2) / 2, _ BitOR($WS_SIZEBOX, $WS_TABSTOP, $WS_MINIMIZEBOX)) $maingui_lv = GUICtrlCreateListView('Col 1|Col 2|Col 3|Col 4|Col 5|Col 6|Col 7|Col 8|Col 9', 0, 0, @DesktopWidth / 2, @DesktopHeight / 2 - 23, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($maingui_lv, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES)) GUICtrlSetResizing($maingui_lv, $GUI_DOCKBORDERS) ;Generate some random data For $i = 0 To 100 GUICtrlCreateListViewItem( _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1), $maingui_lv) Next GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE") GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE") GUISetState() While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $maingui Switch $msg[0] Case $GUI_EVENT_CLOSE Exit EndSwitch EndSwitch WEnd Func WM_SIZE($hWnd, $msg, $wParam, $lParam) Local Static $hTimer = TimerInit() $iWidth = BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord $iHeight = BitShift($lParam, 16) ; _WinAPI_HiWord If TimerDiff($hTimer) > 200 Then _GUICtrlListView_EndUpdate(GUICtrlGetHandle($maingui_lv)) _Resize() _GUICtrlListView_BeginUpdate(GUICtrlGetHandle($maingui_lv)) $hTimer = TimerInit() EndIf EndFunc ;==>WM_SIZE Func WM_ENTERSIZEMOVE($hWnd, $msg, $wParam, $lParam) _GUICtrlListView_BeginUpdate(GUICtrlGetHandle($maingui_lv)) EndFunc ;==>WM_ENTERSIZEMOVE Func WM_EXITSIZEMOVE($hWnd, $msg, $wParam, $lParam) _Resize() _GUICtrlListView_EndUpdate(GUICtrlGetHandle($maingui_lv)) Return $GUI_RUNDEFMSG EndFunc ;==>WM_EXITSIZEMOVE Func _Resize() _GUICtrlListView_SetColumnWidth($maingui_lv, 0, ($iWidth - 17) * 0.20) _GUICtrlListView_SetColumnWidth($maingui_lv, 1, ($iWidth - 17) * 0.30) _GUICtrlListView_SetColumnWidth($maingui_lv, 2, ($iWidth - 17) * 0.03) _GUICtrlListView_SetColumnWidth($maingui_lv, 3, ($iWidth - 17) * 0.08) _GUICtrlListView_SetColumnWidth($maingui_lv, 4, ($iWidth - 17) * 0.07) _GUICtrlListView_SetColumnWidth($maingui_lv, 5, ($iWidth - 17) * 0.07) _GUICtrlListView_SetColumnWidth($maingui_lv, 6, ($iWidth - 17) * 0.10) _GUICtrlListView_SetColumnWidth($maingui_lv, 7, ($iWidth - 17) * 0.10) _GUICtrlListView_SetColumnWidth($maingui_lv, 8, ($iWidth - 17) * 0.05) EndFunc Test2 : expandcollapse popup#include <GuiListView.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Global $iWidth = 0, $iHeight = 0 $maingui = GUICreate('Test', @DesktopWidth / 2, @DesktopHeight / 2, @DesktopWidth / 2 - (@DesktopWidth / 2) / 2, @DesktopHeight / 2 - (@DesktopHeight / 2) / 2, _ BitOR($WS_SIZEBOX, $WS_TABSTOP, $WS_MINIMIZEBOX)) $maingui_lv = GUICtrlCreateListView('Col 1|Col 2|Col 3|Col 4|Col 5|Col 6|Col 7|Col 8|Col 9', 0, 0, @DesktopWidth / 2, @DesktopHeight / 2 - 23, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($maingui_lv, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES)) GUICtrlSetResizing($maingui_lv, $GUI_DOCKBORDERS) ;Generate some random data For $i = 0 To 100 GUICtrlCreateListViewItem( _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1) & "|" & _ Random(0, 1000000, 1), $maingui_lv) Next GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE") GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE") GUISetState() While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $maingui Switch $msg[0] Case $GUI_EVENT_CLOSE Exit EndSwitch EndSwitch WEnd Func WM_SIZE($hWnd, $msg, $wParam, $lParam) $iWidth = BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord $iHeight = BitShift($lParam, 16) ; _WinAPI_HiWord Local Static $iPrevW = $iWidth, $iPrevH = $iHeight Local Const $__DIFF = 10 If Abs($iWidth - $iPrevW) >= $__DIFF Or Abs($iHeight - $iPrevH) >= $__DIFF Then _GUICtrlListView_EndUpdate(GUICtrlGetHandle($maingui_lv)) _Resize() _GUICtrlListView_BeginUpdate(GUICtrlGetHandle($maingui_lv)) EndIf EndFunc ;==>WM_SIZE Func WM_ENTERSIZEMOVE($hWnd, $msg, $wParam, $lParam) _GUICtrlListView_BeginUpdate(GUICtrlGetHandle($maingui_lv)) EndFunc ;==>WM_ENTERSIZEMOVE Func WM_EXITSIZEMOVE($hWnd, $msg, $wParam, $lParam) _Resize() _GUICtrlListView_EndUpdate(GUICtrlGetHandle($maingui_lv)) Return $GUI_RUNDEFMSG EndFunc ;==>WM_EXITSIZEMOVE Func _Resize() _GUICtrlListView_SetColumnWidth($maingui_lv, 0, ($iWidth - 17) * 0.20) _GUICtrlListView_SetColumnWidth($maingui_lv, 1, ($iWidth - 17) * 0.30) _GUICtrlListView_SetColumnWidth($maingui_lv, 2, ($iWidth - 17) * 0.03) _GUICtrlListView_SetColumnWidth($maingui_lv, 3, ($iWidth - 17) * 0.08) _GUICtrlListView_SetColumnWidth($maingui_lv, 4, ($iWidth - 17) * 0.07) _GUICtrlListView_SetColumnWidth($maingui_lv, 5, ($iWidth - 17) * 0.07) _GUICtrlListView_SetColumnWidth($maingui_lv, 6, ($iWidth - 17) * 0.10) _GUICtrlListView_SetColumnWidth($maingui_lv, 7, ($iWidth - 17) * 0.10) _GUICtrlListView_SetColumnWidth($maingui_lv, 8, ($iWidth - 17) * 0.05) EndFunc As you can see it's not conclusive Br, FireFox. Edited February 21, 2014 by FireFox Link to comment Share on other sites More sharing options...
KaFu Posted February 21, 2014 Share Posted February 21, 2014 The LV flicker unnerved me in SMF too, so I just disabled the painting while resizing with this trick: expandcollapse popup; http://www.autoitscript.com/forum/topic/55024-ho-to-set-resizing-without-displaying-window-content/#entry417869 ; by Siao #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <Misc.au3> Opt("GUIOnEventMode", 1) Const $SC_MOVE = 0xF010 Const $SC_SIZE = 0xF000 Global $OldParam $parent = GUICreate("GUI", 200, 400, -1, -1, $WS_SIZEBOX) ;~ GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE") GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE") GUIRegisterMsg($WM_SYSCOMMAND, "On_WM_SYSCOMMAND") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Button = GUICtrlCreateButton("Button",50,100,100,21) GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func On_WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) Switch BitAND($wParam, 0xFFF0) Case $SC_MOVE, $SC_SIZE ;Const $SPI_SETDRAGFULLWINDOWS = 37 ;Const $SPI_GETDRAGFULLWINDOWS = 38 ;Const SPIF_SENDWININICHANGE = 2 $tBool = DllStructCreate("int") DllCall("user32.dll", "int", "SystemParametersInfo", "int", 38, "int", 0, "ptr", DllStructGetPtr($tBool), "int", 0) $OldParam = DllStructGetData($tBool, 1) DllCall("user32.dll", "int", "SystemParametersInfo", "int", 37, "int", 0, "ptr", 0, "int", 2) EndSwitch EndFunc Func WM_EXITSIZEMOVE() DllCall("user32.dll", "int", "SystemParametersInfo", "int", 37, "int", $OldParam, "ptr", 0, "int", 2) EndFunc Func _Exit() Exit EndFunc ;==>_Exit  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...
mpower Posted February 26, 2014 Author Share Posted February 26, 2014 Excellent, thanks FireFox and KaFu. I think the solution from KaFu takes the cake because it elegantly removes the flicker issue by disabling the re-draw during resize. Â Link to comment Share on other sites More sharing options...
mpower Posted February 27, 2014 Author Share Posted February 27, 2014 Quick question KaFu, your solution appears to turn off redraw in Windows, rather than just for the app. Any way to turn it back on once the app is closed? Link to comment Share on other sites More sharing options...
Solution KaFu Posted February 27, 2014 Solution Share Posted February 27, 2014 (edited) You're right, it's a system-wide setting. On the other hand I've used it for years now and never had the problem that the state was not reset correctly, as the reset is fired when you let go the border. It might get stuck when your app exits while resizing; for that maybe use an exit function as outlined below. The only risk left then would be if your app crashes / the process is closed while you're resizing. expandcollapse popup; http://www.autoitscript.com/forum/topic/55024-ho-to-set-resizing-without-displaying-window-content/#entry417869 ; by Siao #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <Misc.au3> Opt("GUIOnEventMode", 1) Const $SC_MOVE = 0xF010 Const $SC_SIZE = 0xF000 Global $i_DRAGFULLWINDOWS_Current Global $i_DRAGFULLWINDOWS_Initial = _SPI_GETDRAGFULLWINDOWS() OnAutoItExitRegister("_Reset_DRAGFULLWINDOWS") Func _Reset_DRAGFULLWINDOWS() DllCall("user32.dll", "int", "SystemParametersInfo", "int", 37, "int", $i_DRAGFULLWINDOWS_Initial, "ptr", 0, "int", 2) EndFunc ;==>_Reset_DRAGFULLWINDOWS $parent = GUICreate("GUI", 200, 400, -1, -1, $WS_SIZEBOX) ;~ GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE") GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE") GUIRegisterMsg($WM_SYSCOMMAND, "On_WM_SYSCOMMAND") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Button = GUICtrlCreateButton("Button", 50, 100, 100, 21) GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func On_WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) Switch BitAND($wParam, 0xFFF0) Case $SC_MOVE, $SC_SIZE ;Const $SPI_SETDRAGFULLWINDOWS = 37 ;Const $SPI_GETDRAGFULLWINDOWS = 38 ;Const SPIF_SENDWININICHANGE = 2 $i_DRAGFULLWINDOWS_Current = _SPI_GETDRAGFULLWINDOWS() DllCall("user32.dll", "int", "SystemParametersInfo", "int", 37, "int", 0, "ptr", 0, "int", 2) EndSwitch EndFunc ;==>On_WM_SYSCOMMAND Func WM_EXITSIZEMOVE() DllCall("user32.dll", "int", "SystemParametersInfo", "int", 37, "int", $i_DRAGFULLWINDOWS_Current, "ptr", 0, "int", 2) EndFunc ;==>WM_EXITSIZEMOVE Func _Exit() Exit EndFunc ;==>_Exit Func _SPI_GETDRAGFULLWINDOWS() $tBool = DllStructCreate("int") DllCall("user32.dll", "int", "SystemParametersInfo", "int", 38, "int", 0, "ptr", DllStructGetPtr($tBool), "int", 0) Return DllStructGetData($tBool, 1) EndFunc ;==>_SPI_GETDRAGFULLWINDOWS Edited February 27, 2014 by KaFu argumentum and mpower 2 Â 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...
mpower Posted March 3, 2014 Author Share Posted March 3, 2014 perfect thanks KaFu! 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