Sign in to follow this  
Followers 0
qwert

Transparency on Win 7/8 ... different?

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



I have noticed that the fogginess of my 3AM thinking resulted in me posting this to the wrong forum. 

Can someone kindly move it to GUI Help and Support?

Many thanks.

Share this post


Link to post
Share on other sites

Got some code we can see?

Share this post


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)
EndIf

GUISetState(@SW_SHOW)

Do
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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

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  
Followers 0