Aero Glass PowerShell by Oisin Grehan 34 months ago
embed code: <script type="text/javascript" src="http://PoshCode.org/embed/2052"></script>download | new post
Enable aero “glass” effects for the regular powershell 2.0 console (not ISE) – vista or above, powershell 2+ and aero-compatible gfx card. .\glass.ps1 # turn on .\glass.ps1 -disable # turn off
- #requires -version 2
- param([switch]$Disable)
- add-type -namespace Hacks -name Aero -memberdefinition @"
- [StructLayout(LayoutKind.Sequential)]
- public struct MARGINS
- {
- public int left;
- public int right;
- public int top;
- public int bottom;
- }
- [DllImport("dwmapi.dll", PreserveSig = false)]
- public static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);
- [DllImport("dwmapi.dll", PreserveSig = false)]
- public static extern bool DwmIsCompositionEnabled();
- "@
- if (([Environment]::OSVersion.Version.Major -gt 5) -and
- [hacks.aero]::DwmIsCompositionEnabled()) {
- $hwnd = (get-process -id $pid).mainwindowhandle
- $margin = new-object 'hacks.aero+margins'
- $host.ui.RawUI.BackgroundColor = "black"
- $host.ui.rawui.foregroundcolor = "white"
- if ($Disable) {
- $margin.top = 0
- $margin.left = 0
- } else {
- $margin.top = -1
- $margin.left = -1
- }
- [hacks.aero]::DwmExtendFrameIntoClientArea($hwnd, [ref]$margin)
- } else {
- write-warning "Aero is either not available or not enabled on this workstation."
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
PowerShell Code Repository