Jump to content

XP - Fades to greyscale. How do they do this?


Recommended Posts

What DLL call if any do I need to do this? You know, when you change your theme in display settings it fades out to black.

Want to integrate this so badly in some programs...

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
Link to comment
Share on other sites

This is pure speculation.

I'm almost certain there is no API call for that feature. What Windows does is takes a snapshot of the screen just before displaying that window. Then it creates a full-screen window and draws the snapshot on it. It then creates a second window to display the message. Then on a timer, it gradually desaturates the snapshot and redisplays it producing the effect you see.

I more or less confirm my speculation with the following small script:

Main()

Func Main()
    Local $hPrev, $hCurrent
    While True
        $hCurrent = WinGetHandle("")
        If $hCurrent <> $hPrev Then
            $hPrev = $hCurrent
            Local $pos = WinGetPos($hCurrent)
            ConsoleWrite("Window: " & WinGetTitle($hCurrent) & @CRLF & _
                @TAB & "x: " & $pos[0] & ", y: " & $pos[1] & ", w: " & $pos[2] & ", h: " & $pos[3] & @CRLF)
        EndIf
        Sleep(10)
    WEnd
EndFunc

What it does is monitors for the active window to change, then it logs the title and size of the window. When I got to Start->Shutdown, I see that a full-screen window is created and another smaller window is created about where the shutdown options box is (Remember that the shutdown options also performs the gray-scale effect).

Link to comment
Share on other sites

This is pure speculation.

I'm almost certain there is no API call for that feature. What Windows does is takes a snapshot of the screen just before displaying that window. Then it creates a full-screen window and draws the snapshot on it. It then creates a second window to display the message. Then on a timer, it gradually desaturates the snapshot and redisplays it producing the effect you see.

I more or less confirm my speculation with the following small script:

Main()

Func Main()
    Local $hPrev, $hCurrent
    While True
        $hCurrent = WinGetHandle("")
        If $hCurrent <> $hPrev Then
            $hPrev = $hCurrent
            Local $pos = WinGetPos($hCurrent)
            ConsoleWrite("Window: " & WinGetTitle($hCurrent) & @CRLF & _
                @TAB & "x: " & $pos[0] & ", y: " & $pos[1] & ", w: " & $pos[2] & ", h: " & $pos[3] & @CRLF)
        EndIf
        Sleep(10)
    WEnd
EndFunc

What it does is monitors for the active window to change, then it logs the title and size of the window. When I got to Start->Shutdown, I see that a full-screen window is created and another smaller window is created about where the shutdown options box is (Remember that the shutdown options also performs the gray-scale effect).

This is interesting. I played around with it a while and keep getting this error in the console:

Window: C:\Documents and Settings\Administrator\Desktop\tmp.au3 - SciTE

x: 0, y: 0, w: 922, h: 691

Window:

x: -2, y: 740, w: 1028, h: 30

Window: C:\Documents and Settings\Administrator\Desktop\tmp.au3 - SciTE

x: 60, y: 4, w: 922, h: 691

Window:

x: -2, y: 740, w: 1028, h: 30

Window:

x: 356, y: 190, w: 314, h: 200

Window:

x: 0, y: 0, w: 1024, h: 768

Window: C:\Documents and Settings\Administrator\Desktop\tmp.au3 - SciTE

x: 60, y: 4, w: 922, h: 691

Window:

x: -2, y: 740, w: 1028, h: 30

Window:

x: 0, y: 0, w: 1024, h: 768

Window:

x: 356, y: 190, w: 314, h: 200

Window: C:\Documents and Settings\Administrator\Desktop\tmp.au3 - SciTE

x: 60, y: 4, w: 922, h: 691

Window:

x: -2, y: 740, w: 1028, h: 30

Window:

x: 0, y: 0, w: 1024, h: 768

Window:

x: 356, y: 190, w: 314, h: 200

C:\Documents and Settings\Administrator\Desktop\tmp.au3 (10) : ==> Subscript used with non-Array variable.:

ConsoleWrite("Window: " & WinGetTitle($hCurrent) & @CRLF & @TAB & "x: " & $pos[0] & ", y: " & $pos[1] & ", w: " & $pos[2] & ", h: " & $pos[3] & @CRLF)

ConsoleWrite("Window: " & WinGetTitle($hCurrent) & @CRLF & @TAB & "x: " & $pos^ ERROR

+>AutoIT3.exe ended.rc:0

>Exit code: 0 Time: 69.827

Link to comment
Share on other sites

Yes, that will happen. The script wasn't mean to be anything more than a quick test to see the size (and possibly name) of any windows created during the fade effect. Simply put the ConsoleWrite() call into a conditional statement ensuring that $pos is really an array and the problem will go away.

Link to comment
Share on other sites

Hi,

we had a short discussion about that in the German forum and bernd670 found this article.

Maybe some of the good guys could rewrite this. :P

Link FadeToGrey

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Yes, that will happen. The script wasn't mean to be anything more than a quick test to see the size (and possibly name) of any windows created during the fade effect. Simply put the ConsoleWrite() call into a conditional statement ensuring that $pos is really an array and the problem will go away.

@Valik -

Yes thanks, I realized that later, after keeping the script open and doing a Start>Logoff sequence.

BTW - Congratulations on 6,000 posts! Amazing. Your very busy here, and helpful!

ViM

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...