Main Area and Open Discussion > General Software Discussion
GlassPrompt 1.1
MilesAhead:
GlassPrompt 1.0 This should be the first and last version as it's pretty simple.
The effect is the same as my PromptHere utility, which is to open a command prompt with a "blur behind" effect. The difference is this just opens to the current directory. To have it open to a directory other than where the program is located, make a shortcut and use the "Start in" field.
The reason I wrote this is because I started playing around with FreeBASIC compiler. I noticed the compiled executables were tiny. Even with an icon and file version resources in the .exe it comes in at only 23 KB. It's just a toy.
To get the blur effect the system must be either Vista or Windows Seven with Glass enabled. On XP you'll just get an ordinary command prompt but with "GlassPrompt" in the caption.
You can download here:
http://www.favessoft.com/downloads.html
edit: I fixed a bug which caused orphaned hidden command prompts. The current download on my site has the fixed version. To be certain, right click GlassPrompt.exe and look in Properties, Details. The fixed version will show file version 1.0.0.1.
Or you can just look in task manager. If 2 cmd.exe instances are added in TM every time you run it, instead of one, it's the broken version. :)
MilesAhead:
GlassPrompt 1.1 Smoothed the application of the blur effect. Now sets prompt caption directly instead of using Windows Start command.
Now when the window becomes visible the blur is already applied. No more starting with black background, then changing color. Also by setting the caption directly using a WinAPI call, there's no longer a prompt launched just to use Windows Start command. Looks a lot nice coming up now.
Of course if you have XP it will just show the ordinary prompt. No sense running it unless you have Vista or later OS with Glass enabled.
parkint:
Sweet (little) application.
Thanks for sharing!
f0dder:
That's kinda cute, how does it work? I assume it's some new Vista+ API that has to do with dwm? :)
MilesAhead:
That's kinda cute, how does it work? I assume it's some new Vista+ API that has to do with dwm? :)
-f0dder (July 25, 2010, 02:33 PM)
--- End quote ---
Yes, it's OSMajor 6.0 minimum.
Some guys have been messing with Blur Behind effect on a prompt for awhile on AutoIt3 forum. It uses DwmIsCompositionEnabled to check if Glass is enabled and DwmEnableBlurBehindWindow to enable the blur effect. Unfortunately it only looks good when the background is black. Which makes it work well with prompts as most people don't bother to change the background color and the text reverts to white.
If you just enable Glass or blur on a program window, all the controls are zapped and you can't read the text in buttons. That's why in my programs like Selector and ReOpen I just use the thick glass border. There's some stuff on Code Project how to draw text and stuff on glass but it's a royal pain.
Here's the functions in FreeBASIC. There may be neater ways to do it. I did these functions before I found all the WinAPI stuff included with the compiler. But it works. :)
--- ---'' MilesAhead.bas - reusable function library for Windows
#include once "windows.bi"
#Include once "vbcompat.bi"
#include once "win/shellapi.bi"
'returns non 0 if Glass enabled on system
Function GlassEnabled() As Integer
Dim As HMODULE hModule
hModule = LoadLibrary( "dwmapi.dll" )
If hModule = 0 Then Return 0
Dim DwmIsCompositionEnabled As Function(pfEnabled As Integer Ptr) As HRESULT
Dim enabled As Integer = 0
DwmIsCompositionEnabled = GetProcAddress(hModule,"DwmIsCompositionEnabled")
If DwmIsCompositionEnabled = 0 Then
FreeLibrary(hModule)
Return 0
End If
DwmIsCompositionEnabled(@enabled)
FreeLibrary(hModule)
Return enabled
End Function
Function EnableBlurBehind( hw As hwnd ) As Integer
If GlassEnabled() = 0 Then Return 0
Type BlurStruct
dwFlags As DWORD
fEnable As BOOL
hRgnBlur As HRGN
fTransitionOnMaximized As BOOL
End Type
Dim bStruct As BlurStruct
bStruct.dwFlags = 1
bStruct.fEnable = 1
bStruct.hRgnBlur = Cast(HRGN,hw)
bStruct.fTransitionOnMaximized = Cast(BOOL,1)
Dim As HMODULE hModule
hModule = LoadLibrary( "dwmapi.dll" )
If hModule = 0 Then Return 0
Dim DwmEnableBlurBehindWindow As Function(hWnd As HWND, bs As BlurStruct Ptr) As HRESULT
DwmEnableBlurBehindWindow = GetProcAddress(hModule,"DwmEnableBlurBehindWindow")
If DwmEnableBlurBehindWindow = 0 Then
FreeLibrary(hModule)
Return 0
End If
Dim As HRESULT result = 0
result = DwmEnableBlurBehindWindow(Cast(hwnd,hw),@bStruct)
FreeLibrary(hModule)
If result = 0 Then
Return 1
Else
Return 0
End If
End Function
Navigation
[0] Message Index
[#] Next page
Go to full version