🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #3991

Creating / mimicing the XP shutdown grey fade...

#3991
From: Mike Collins
Date: Wed, 29 Mar 2006 23:53
38 lines
2697 bytes
Couldn't think of a better way to describe my task so sorry about the 
ambiguous subject line...

I have a task that I need to complete and I'm not 100% sure how to do it. 
Basically I need to recreate the visual effect that Windows XP/2003 have 
when you option to shut down or restart.  When this happens, it appear as if 
the screen fades out so a semi-transparent grey colour.

So I need to mimic the same behaviour in my application.  I have one form 
(MainForm) that is set as fsStayOnTop, then I need to display another form 
(Dialog) on top of that but fade the original one.  Now I have a few 
thoughts on how to do this but I just wanted to see if anyone else had done 
this or could point me in the right direction.

So my thoughts are:
1) Create a hidden panel on the MainForm (assuming that the Mainform has 
it's title bar removed...).
2) When fade effect is needed, create a TBitmap and then capture the 
'desktop' using Bmp->Canvas->Handle=GetDC(0);
3) Assign the Bmp to the Hidden Panel, then show the panel and maximise to 
the full screen.
4) Create a thread or use a timer to increment the colour of this desktop 
image.
5) Create the secondary dialog and leave the thread / timer running to 
increment the colour of each pixel.

- I'm not sure if that makes sense to anyone else but it makes some sense to 
me.  My main problem is that I'm not sure of the best way to increment the 
colour of the pixels and what sort of algorithm to use to convert an RGB 
value to a grey scale colour.  Also is it best to alter the Bmp's canvas and 
then re-assign or modify the panel directly.

I know this is a bit vague but any advice would be greatly appreciated so as 
to steer me down the right path...

Many thanks in advance,

Mike C 
Technical Details
Message-ID: <442b1df3$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ff65259e4dac42c3,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mike Collins" <its@TheBottomOfThePost.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Creating / mimicing the XP shutdown grey fade...
Date: Thu, 30 Mar 2006 00:53:22 +0100
Lines: 40
Organization: SDA Ltd
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
NNTP-Posting-Host: 81.2.92.14
Message-ID: <442b1df3$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1143676403 81.2.92.14 (29 Mar 2006 15:53:23 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail