Jump to content
Sign in to follow this  
shaneG

Remove a Window from Aero Peek in Windows 7

Recommended Posts

shaneG

I found an article here which helps remove any window from the "AeroPeek" feature of Windows 7.

The idea is to call the "dwmapi.dll" and excecute the function DwmSetWindowAttribute and set the property "DWMWA_EXCLUDED_FROM_PEEK" to true.

Could somebody help me with that script ?

Thanks in Advance

shaneGirish

__________________

"Never underestimate a child's ability to get into more trouble."

Share this post


Link to post
Share on other sites
lujomu

In case you are still interested ... here you go:

Func _setExcludeFromPeek( Const $hWnd, $exclude = True)

    Local $struct, $dllReturn

    $struct = DllStructCreate( "int")

    if ( $exclude) Then
        DllStructSetData( $struct, 1, 1)
    Else
        DllStructSetData( $struct, 1, 0)
    EndIf

    $dllReturn = DllCall(   "dwmapi.dll", _
                            "int",      "DwmSetWindowAttribute", _
                            "hwnd",     $hWnd, _
                            "dword",    12, _
                            "ptr",      DllStructGetPtr( $struct), _
                            "dword",    DllStructGetSize( $struct)      )

    If ( @error = 0 And $dllReturn[0] = 0) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc

Exclude e.g. 'Calculator' window from Aero Peek using ...

$handle = WinGetHandle("Calculator")
_setExcludeFromPeek( $handle)
... or ...

$handle = WinGetHandle("Calculator")
_setExcludeFromPeek( $handle, True)
And include it again using ...

$handle = WinGetHandle("Calculator")
_setExcludeFromPeek( $handle, False)

Cheers,

lujomu

Share this post


Link to post
Share on other sites
KaFu

Share this post


Link to post
Share on other sites
KaFu

I've already written the functions for the Aero areas and such, check it out here.

Yeah, those should definitly be included too, nice stuff ;). But what I'm more of fighting with atm is windows sizing and (relative) positioning, theres always a difference between aero and non aero (relative) positioning. Whats definitly needed is a WinSetPosEx() function auto-"compensating" the aero effects.

Share this post


Link to post
Share on other sites
James

Yeah, those should definitly be included too, nice stuff ;). But what I'm more of fighting with atm is windows sizing and (relative) positioning, theres always a difference between aero and non aero (relative) positioning. Whats definitly needed is a WinSetPosEx() function auto-"compensating" the aero effects.

Shouldn't be too hard. You can use the DwmIsCompositionEnabled to check whether DWM is turned on. But then you need to also find out the size of the window border. But I'm sure at least one of the functions already does that.

Share this post


Link to post
Share on other sites
KaFu

Shouldn't be too hard. You can use the DwmIsCompositionEnabled to check whether DWM is turned on. But then you need to also find out the size of the window border. But I'm sure at least one of the functions already does that.

Thats exactly what can be done by comparing WinGetPos() results to my WinGetPosEx() function ;)... my problem is just what are the (are there any?) generic and coherent adjustments needed to have not the same but a similar style with aero on and off.

Share this post


Link to post
Share on other sites
James

Thats exactly what can be done by comparing WinGetPos() results to my WinGetPosEx() function ;)... my problem is just what are the (are there any?) generic and coherent adjustments needed to have not the same but a similar style with aero on and off.

Surely they should be found in the registry?

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.