Screen blur alpha effect

Post your tools and samples or ask for them.
Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 2837
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Screen blur alpha effect

Post by Dave Rabelink » 05 Feb 2019, 11:16

I created a sample for a particular solution.

It will display a messagebox while the entire screen is covered with a blur effect.
It is done by creating a borderless/captionless dialog, maximized including covering the windows taskbar and set to TOPMOST.

On top of this blurred dialog a normal messagebox is displayed.
This emphasizes the importance of the messagebox.

You can play with this solution and make it fit your needs.
Other things to consider is to disable switching to other screens using ALT-TAB for instance.

It looks like this:

BlurEffect_MsgBox.png

The sample can be downloaded here (saved in TD21 text format and works on all TD versions)

https://samples.tdcommunity.net/index.p ... rch_mode=f
You do not have the required permissions to view the files attached to this post.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Viswanadha
India
Posts: 22
Joined: 12 Jul 2018, 10:24
Location: Chennai, India

Re: Alternate way to achieve System Modal dialog box function

Post by Viswanadha » 05 Feb 2019, 13:24

Thanks Dave. This really helps me to convince business what I can achieve. I will try to modify the code according to my requirement.

Once again thank you so much.

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 2837
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Alternate way to achieve System Modal dialog box function

Post by Dave Rabelink » 05 Feb 2019, 16:03

I forgot to mention that the sample as intended is only working on Windows 10.
(On Windows 7, the screen will be black and not blurred)

I'm currently changing the sample so it also blurs also on Windows 7.
When ready, I will replace the sample download and report it here.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Viswanadha
India
Posts: 22
Joined: 12 Jul 2018, 10:24
Location: Chennai, India

Re: Alternate way to achieve System Modal dialog box function

Post by Viswanadha » 06 Feb 2019, 04:20

Thank you for the information Dave.

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 2371
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: Alternate way to achieve System Modal dialog box function

Post by Jeff Luther » 06 Feb 2019, 20:40

Dave -- it seems it doesn't work on Win v8.1 either, FYI.
Jeff Luther @ PC Design
Palm Springs, California
TD info. & samples: http://www.jeffluther.net/TD/

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 2837
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Alternate way to achieve System Modal dialog box function

Post by Dave Rabelink » 07 Feb 2019, 11:00

Jeff Luther wrote:
06 Feb 2019, 20:40
Dave -- it seems it doesn't work on Win v8.1 either, FYI.
Thanks Jeff for this info.


Well, Microsoft isn't making it easy for us.

Some background info:

The blur effect was initially introduced with the function DwmEnableBlurBehindWindow.
(Vista/Windows 7)

But then, on Windows 8 and higher, this function is not working anymore due to the fact that Aero-glass feature was removed.
Instead, on Windows 10, we can use SetWindowCompositionAttribute. This is not (yet) documented on MSDN.

So we need to determine the Windows OS version first to call the correct function.
But in Windows 10, the Windows version API functions have been changed. From TD we can not use the good old GetVersion and GetVersionEx functions anymore.
They depend on application manifests, which we can not control in TD.

The Vis function for getting Windows OS version is also broken on older TD versions.

So, I created a fairly safe way to determine the Windows OS version, which I included in the sample.

I have uploaded the changed sample and it works like this:

- Windows 7 -> BLUR effect using DwmEnableBlurBehindWindow
- Windows 10 -> BLUR effect using SetWindowCompositionAttribute
- Other OS -> TRANSPARENT ALPHA effect using SetLayeredWindowAttributes

The ALPHA effect is not a real blur. It will use a semi-transparent effect (ALPHA channel) which grays out the desktop which also has the visual effect that the messagebox stands out.

You can download the sample here:

https://samples.tdcommunity.net/index.p ... rch_mode=f
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Harald
Germany
Posts: 132
Joined: 30 Mar 2017, 06:16
Location: Oberhaching/Munich, Germany

Re: Screen blur alpha effect

Post by Harald » 07 Feb 2019, 11:41

Hello Dave,

if you have two monitors, the second monitor is not locked.

Kind regards
Harald

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 2837
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Screen blur alpha effect

Post by Dave Rabelink » 07 Feb 2019, 12:23

Harald wrote:
07 Feb 2019, 11:41
if you have two monitors, the second monitor is not locked.
Yes, good one.

Will add support for multi-monitor setup.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Return to “Tools & Samples”

Who is online

Users browsing this forum: [Ccbot], Dave Rabelink and 0 guests