因为我可以在控制台应用程序上激活玻璃效果。我使用的是 Windows 7 和 Delphi 2010。
我发现 这个应用程序,所以它应该是可能的。
As I can activate the glass effect on my console applications. I am using Windows 7 and Delphi 2010.
I found this application so it should be possible.
几周前,我发布了 我的博客上的这篇文章。
关键是使用 GetConsoleWindow 和 DwmEnableBlurBehindWindow函数。
GetConsoleWindow
DwmEnableBlurBehindWindow
函数。
GetConsoleWindow 函数检索与调用进程关联的控制台所使用的窗口句柄。
DwmEnableBlurBehindWindow 函数在提供的窗口句柄上启用模糊效果(玻璃)。
program ConsoleGlassDelphi; {$APPTYPE CONSOLE} uses Windows, SysUtils; type DWM_BLURBEHIND = record dwFlags : DWORD; fEnable : BOOL; hRgnBlur : HRGN; fTransitionOnMaximized : BOOL; end; function DwmEnableBlurBehindWindow(hWnd : HWND; const pBlurBehind : DWM_BLURBEHIND) : HRESULT; stdcall; external 'dwmapi.dll' name 'DwmEnableBlurBehindWindow';//function to enable the glass effect function GetConsoleWindow: HWND; stdcall; external kernel32 name 'GetConsoleWindow'; //get the handle of the console window function DWM_EnableBlurBehind(hwnd : HWND; AEnable: Boolean; hRgnBlur : HRGN = 0; ATransitionOnMaximized: Boolean = False; AFlags: Cardinal = 1): HRESULT; var pBlurBehind : DWM_BLURBEHIND; begin pBlurBehind.dwFlags:=AFlags; pBlurBehind.fEnable:=AEnable; pBlurBehind.hRgnBlur:=hRgnBlur; pBlurBehind.fTransitionOnMaximized:=ATransitionOnMaximized; Result:=DwmEnableBlurBehindWindow(hwnd, pBlurBehind); end; begin try DWM_EnableBlurBehind(GetConsoleWindow(), True); Writeln('See my glass effect'); Writeln('Go Delphi Go'); Readln; except on E:Exception do Writeln(E.Classname, ': ', E.Message); end; end.
这只是一个基本示例;您必须检查 Windows 操作系统版本以避免出现问题。
A couple of weeks ago I published this article on my blog.
The key is use the GetConsoleWindow and DwmEnableBlurBehindWindow functions.
The GetConsoleWindow function retrieves the window handle used by the console associated with the calling process.
The DwmEnableBlurBehindWindow function enables the blur effect (glass) on the provided window handle.
This is just a basic example; you must check the Windows OS version to avoid issues.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
几周前,我发布了 我的博客上的这篇文章。
关键是使用
GetConsoleWindow
和DwmEnableBlurBehindWindow
函数。
GetConsoleWindow
函数检索与调用进程关联的控制台所使用的窗口句柄。DwmEnableBlurBehindWindow
函数在提供的窗口句柄上启用模糊效果(玻璃)。这只是一个基本示例;您必须检查 Windows 操作系统版本以避免出现问题。
A couple of weeks ago I published this article on my blog.
The key is use the
GetConsoleWindow
andDwmEnableBlurBehindWindow
functions.The
GetConsoleWindow
function retrieves the window handle used by the console associated with the calling process.The
DwmEnableBlurBehindWindow
function enables the blur effect (glass) on the provided window handle.This is just a basic example; you must check the Windows OS version to avoid issues.