Page 1 of 1

Disabling fade effect on gui animations

Posted: 04 Feb 2017, 11:17
by Klark92

Code: Select all

; Disable Fading Effect On Guis
DllCall("SystemParametersInfo","UInt",0x1043,"UInt",0,"UInt",0)
Progress, 100, Loading, Please Wait...
Progress, Off
DllCall("SystemParametersInfo","UInt",0x1043,"UInt",0,"UInt",1)
You can put that code top of your script and you dont need to call that again...

It removes bad fade effect on gui when we use Imaged Button Class/imaged buttons/checks/radios/progress bars....

Source : https://autohotkey.com/boards/viewtopic ... 23#p129823

This subject is opened by just me's offer...

Re: Removing fade effect/animations on all Guis

Posted: 04 Feb 2017, 12:23
by tmplinshi
Nice. Hide the progress window would be better:

Code: Select all

DisableFadeEffect() {
	; SPI_GETCLIENTAREAANIMATION = 0x1042
	DllCall("SystemParametersInfo", "UInt", 0x1042, "UInt", 0, "UInt*", isEnabled, "UInt", 0)

	if isEnabled {
		; SPI_SETCLIENTAREAANIMATION = 0x1043
		DllCall("SystemParametersInfo", "UInt", 0x1043, "UInt", 0, "UInt", 0, "UInt", 0)
		Progress, 10:P100 Hide
		Progress, 10:Off
		DllCall("SystemParametersInfo", "UInt", 0x1043, "UInt", 0, "UInt", 1, "UInt", 0)
	}
}

Re: Removing fade effect/animations on all Guis

Posted: 04 Feb 2017, 12:31
by Helgef
I didn't see any effect at all, on win7.
When needed, I do this,

Code: Select all

#SingleInstance, force
Gui, new, +hwndguiId
Dwm_SetWindowAttributeTransistionDisable(guiId,1)
Gui, show, w300 h200
Sleep,2000
Gui,destroy
Exitapp

Dwm_SetWindowAttributeTransistionDisable(hwnd,onOff)
{
	;
	;	DWMWA_TRANSITIONS_FORCEDISABLED=3
	;	Use with DwmSetWindowAttribute. Enables or forcibly disables DWM transitions.
	;	The pvAttribute parameter points to a value of TRUE to disable transitions or FALSE to enable transitions.
	;
	dwAttribute:=3
	cbAttribute:=4
	VarSetCapacity(pvAttribute,4,0)
	NumPut(onOff,pvAttribute,0,"Int")
	hr:=DllCall("Dwmapi.dll\DwmSetWindowAttribute", "Uint", hwnd, "Uint", dwAttribute, "Uint", &pvAttribute, "Uint", cbAttribute)
	return hr
}
This only affects the windows of choise, while
SystemParametersInfo wrote: Retrieves or sets the value of one of the system-wide parameters.
Edit: Maybe I missed the point, is this related specifically to Progress windows?

Re: Removing fade effect/animations on all Guis

Posted: 04 Feb 2017, 12:38
by Klark92
@Helgef :

Image

tmplinshi shared this gif before and this fix is for that and similar problem actually :)

Re: Removing fade effect/animations on all Guis

Posted: 04 Feb 2017, 13:28
by Helgef
Ok, looks like I missed the point, sorry. Thanks for sharing :thumbup:

Re: Removing fade effect/animations on all Guis

Posted: 04 Feb 2017, 15:11
by Klark92
You're welcome, and thanks tmplinshi for improvemented codes :)