Jump to content

Transparency on Win 7/8 ... different?

Recommended Posts

Generally speaking, does transparency work differently on Win 7/8 compared to XP?  I have a application that places text over a PNG graphic using the grey.gif method as the basis for background transparency for the text layer.  The method is used in several different ways in examples on these forums.

But when I try to run the script under Win 7 or Win 8, the layer with the text is missing.  I haven't been able to get a handle on what approach to use in determining what the differences might be.

Has anyone experienced this situation?

Thanks in advance for any help.


Edited by qwert
Link to post
Share on other sites

I think this might be related to DWM (Aero effects) on Vista and Win7 (maybe Win8 too?). DWM is using a buffer for painting, which is inaccessible afaik with the known APIs, and the order of control painting is reversed in that buffer. Try something like this:

#include <GUIConstantsEx.au3>

GUICreate("My GUI")

If Not __DwmIsCompositionEnabled() Then ; control order for XP
$c_Pic_A = GUICtrlCreatePic("a.jpg", 0, 0, 400, 100)
$c_Pic_B = GUICtrlCreatePic("b.jpg", 0, 0, 400, 100)
Else ; control order if DWM is enabled
$c_Pic_B = GUICtrlCreatePic("b.jpg", 0, 0, 400, 100)
$c_Pic_A = GUICtrlCreatePic("a.jpg", 0, 0, 400, 100)


Local $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

Func __DwmIsCompositionEnabled()
Local $IStruct = DllStructCreate("int;")
DllCall("dwmapi.dll", "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($IStruct))
Return DllStructGetData($IStruct, 1)
EndFunc ;==>__DwmIsCompositionEnabled
Link to post
Share on other sites

Thank you for that tip.  It got me thinking about other factors that might be involved.

What I've found with my test script is that (apparently) Win 7/8 require their (newer) versions of some of the DLLs.  When I compile the test script on a Win 8 PC, it displays layered text correctly.  When the exact script is compiled under XP, but run under Win 8, the text is missing.

I won't be able to compile my full script under Win 8 until next week, but I'm confident it's going to work.

Edited by qwert
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...