Archive: NSIS & Windows Aero


NSIS & Windows Aero
  Hi @all

I use NSIS for a long time to make my installers. And i use it to write little applications too. It produces small and fast files. And the most important hing for me is that you have no depencies to .NET or VC Runtimes... With nsDialogs and ResHacker you could satisfy almost all design whishes. Almost...

Today (i had a little time) i played around with the system plugin and the DWM API (DwmExtendFrameIntoClientArea) and i had a little success. But some questions too.

With DwmExtendFrameIntoClientArea you can extend the Aero glass window border behind the client area. You can control it via marginvalues. For example {0,0,0,25} to extend the bottom margin. And if you use negative values (-1) you get the "sheet of glass" effect where you have a complete glass window. Here you´ll find more information.

Here my example code. Put it in the .onGuiInit function:

SetCtlColors $HWNDPARENT 0xFFFFFF 0x000000         ;set windowbackground to black

System
::Call "*(i 0, i 0, i 0, i 35) i .r0" ; for "sheet of glass" (i -1, i -1, i -1, i -1)
>System::Call 'dwmapi::DwmExtendFrameIntoClientArea(i $HWNDPARENT, i r0)'
And a screenshot:

http://www.miranda-fusion.de/wp-pics...1/aerotest.jpg

Now the problems. The text of all controls with glass behind seems to be transparent. First i thought this was because of black as text color. But you can use every color and they seems to be mixed up with the glass. Any idea to fix that?

Sincerely,

André

Hi
I tried this in my installer and I found out that it is not a problem of the text.
I am using SkinnedControls for custom bitmaps and buttons and it seems that there is another layer over button controls, which hides the text...


The standard windows controls do not work well on glass


...
  Yup. Using GDI with DWM causes this funny things. :)

I did a research and it seems like it is as i said it before...

It so happens that the bit pattern for RGB black (0x00000000) is the same as the bit pattern for 100% transparent ARGB so you can actually draw with “black” GDI brush and assuming you’ve instructed the DWM to blur the painted area, the result will be the desired glass effect.
but...

The trouble with using this technique for rendering glass is that anything you might want to draw on your window better not use a black GDI brush otherwise it will also appear translucent.
I found it here.

The simple way is to use the SetLayeredWindowAttributes function. With this function we can specify another RGB color than black so that any pixels painted with this color will be transparent. The harder way is the UpdateLayeredWindow function.

But i dont know how to "convert" these hints into NSIS Code...

IIRC the SetLayeredWindowAttributes hack broke in Vista SP1.


...
  Uh....

that sounds bad. So i have to dig deeper in this...

thx for your replies...