Jump to content

Listview flicker on gui resize


mpower
 Share

Go to solution Solved by KaFu,

Recommended Posts

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:

#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 by mpower
Link to comment
Share on other sites

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

#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 by AZJIO
Link to comment
Share on other sites

This would be the flawless way to do it :

#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

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

Test1 :

#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 :

#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 by FireFox
Link to comment
Share on other sites

The LV flicker unnerved me in SMF too, so I just disabled the painting while resizing with this trick:

; 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
Link to comment
Share on other sites

  • Solution

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.

; 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 by KaFu
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...