The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Ehtyar on August 20, 2006, 09:04:34 AM

Title: Notification for showing dialog?
Post by: Ehtyar on August 20, 2006, 09:04:34 AM
Hi all.
I'm creating a dialog with DialogBoxParam, and i wish to make it fade in. I'm looping through SetLayeredWindowAttribute to increase the opacity (can't use AnimateWindow as the dialog is meant to be slightly transparent when the loop ends), but i'm having a problem. I'm calling the routine from the WM_INITDIALOG notification, but unfortunately none of the controls on my dialog are drawn at the time when WM_INITDIALOG is recieved. It is a custom dialog. Out of all the notifications i am monitoring, WM_PAINT seems to be the last one called prior to the dialog being fully drawn, but calling the fade in proc at WM_PAINT is not practical. I'm hoping someone has an idea on what notification i could use to call the fade in proc, so that all the controls are drawn prior to recieving the notification. Any help is appreciated, thank you.

Ehtyar
Title: Re: Notification for showing dialog?
Post by: Phoenix on August 20, 2006, 09:49:15 AM
Hi Ehtyar,

maybe this link helps:

http://www.codeproject.com/dialog/smoothalpha.asp
Title: Re: Notification for showing dialog?
Post by: Ehtyar on August 20, 2006, 12:03:18 PM
Oh Phoenix thanks sooooo much, i tried a trick with RedrawWindow earlier but with different args, excellent link, thanks again :D

Ehtyar
Title: Re: Notification for showing dialog?
Post by: Mark Jones on August 21, 2006, 03:06:51 AM
I had to try this, thanks Phoenix! Attached is a version which uses a timer to fade based on duration instead of interval.

[attachment deleted by admin]
Title: Re: Notification for showing dialog?
Post by: Phoenix on August 21, 2006, 07:02:06 PM
Glad it helped....

Mark, this is an excellent example! IMO, you should ensure that the maximum opaque value is exactly the required one? I did not test the value of eax (dwTransparency) in FadeIn/FadeOut, but it seems that the calculated value in eax can exceed the desired one...