﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
935	WinSetState() lags	trancexx		"I tested this on various systems and the result is the same. This function lags for some reason. I read the documentation and couldn't find explanation for this strange behaviour. So, if someone would check if this is '''intended''' because it's really unexpected and kind of weird (probably there is some better word to describe it).
I wrote a little script to demonstrate it. Did try to be as far away as I could from native functions made for making guis to eliminate possible ''shortcuts'' and still to be compact:
{{{
Global $hGui = GUICreate(""Test"", 300, 300, 20, 100)

GUICtrlCreateLabel(""WinSetState functions:"", 15, 70, 130)
Global $hButtonShowWindow_AutoIt = GUICtrlCreateButton(""ShowWindow"", 20, 100, 100, 25)
Global $hButtonHideWindow_AutoIt = GUICtrlCreateButton(""HideWindow"", 20, 150, 100, 25)

GUICtrlCreateLabel(""DllCall:"", 190, 70, 130)
Global $hButtonShowWindow_DllCall = GUICtrlCreateButton(""ShowWindow"", 170, 100, 100, 25)
Global $hButtonHideWindow_DllCall = GUICtrlCreateButton(""HideWindow"", 170, 150, 100, 25)

;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Global $bDialog = ""0x0100FFFF00000000000004004C0ACC80040000000000A2005F00000000004100"" & _
		""750074006F0049007400200049006E00700075007400200042006F0078000000"" & _
		""0800000000014D00530020005300680065006C006C00200044006C0067000000"" & _
		""0000000000000000000002500700070093002C00EA030000FFFF820050007200"" & _
		""6F006D0070007400000000000000000000000000800081500700380093000C00"" & _
		""E9030000FFFF8100000000000000000000000000010001501000490032000E00"" & _
		""01000000FFFF80004F004B000000000000000000000000000000015057004900"" & _
		""32000E0002000000FFFF8000430061006E00630065006C0000000000""

Global $tDialog = DllStructCreate(""byte["" & BinaryLen($bDialog) & ""]"")
DllStructSetData($tDialog, 1, $bDialog)

Global $aCall = DllCall(""user32.dll"", ""hwnd"", ""CreateDialogIndirectParamW"", _
		""hwnd"", 0, _
		""ptr"", DllStructGetPtr($tDialog), _
		""hwnd"", $hGui, _
		""ptr"", 0, _
		""lparam"", 0)

Global $hDialog = $aCall[0]
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


GUISetState()

While 1
	Switch GUIGetMsg()
		Case - 3
			Exit
		Case $hButtonShowWindow_AutoIt
			WinSetState($hDialog, 0, @SW_SHOW)
		Case $hButtonShowWindow_DllCall
			DllCall(""user32.dll"", ""int"", ""ShowWindow"", ""hwnd"", $hDialog, ""int"", @SW_SHOW)
		Case $hButtonHideWindow_AutoIt
			WinSetState($hDialog, 0, @SW_HIDE)
		Case $hButtonHideWindow_DllCall
			DllCall(""user32.dll"", ""int"", ""ShowWindow"", ""hwnd"", $hDialog, ""int"", @SW_HIDE)
	EndSwitch
WEnd
}}} 

I did manage to find out that WinSetState() eventually calls ShowWindow function the same way I did in that script and that the lag is likely with what comes after that.

Thanks."	Bug	closed		AutoIt	3.3.0.0	None	No Bug		
