Old 28th January 2011, 00:11   #1
Highcoder
Member
 
Join Date: Jan 2011
Posts: 69
Question 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:

PHP Code:
SetCtlColors $HWNDPARENT 0xFFFFFF 0x000000          ;set windowbackground to black
System
::Call "*(i 0, i 0, i 0, i 35) i .r0"               ; for "sheet of glass" (-1-1-1-1)
System::Call 'dwmapi::DwmExtendFrameIntoClientArea(i $HWNDPARENT, i r0)' 
And a screenshot:



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é
Highcoder is offline   Reply With Quote
Old 28th January 2011, 09:32   #2
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 561
Send a message via ICQ to T.Slappy
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...

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 28th January 2011, 11:28   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,424
The standard windows controls do not work well on glass

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 28th January 2011, 19:23   #4
Highcoder
Member
 
Join Date: Jan 2011
Posts: 69
Unhappy ...

Yup. Using GDI with DWM causes this funny things.

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

Quote:
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...

Quote:
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...
Highcoder is offline   Reply With Quote
Old 28th January 2011, 20:41   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,424
IIRC the SetLayeredWindowAttributes hack broke in Vista SP1.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 28th January 2011, 20:51   #6
Highcoder
Member
 
Join Date: Jan 2011
Posts: 69
Unhappy ...

Uh....

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

thx for your replies...
Highcoder is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
aero, glass, transparent

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump