📄 bclayeredwindows.pas
字号:
{ Unit: BcLayeredWindows
===========================================================================
Created: 2001-07-29 (yyyy-mm-dd)
===========================================================================
The contents of this file are subject to the Bluecave Public License V 1.1
(the "License"). You may not copy or use this file, in either source code
or executable form, except in compliance with the License. You may obtain
a copy of the License at http://www.bluecave.net/licenses/.
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (C) 2001 Bluecave Software. All Rights Reserved.
http://www.bluecave.net/
Copyright (C) 2001 Jouni Airaksinen. All Rights Reserved.
http://Mintus.Codefield.com/ -- Mintus@Codefield.com
===========================================================================
Unit description:
Needed definitions for Layered Windows API.
Notes: This is not complete api as it has been made for BarMenu Components.
It might be expanded later. API is loaded dynamically, so be sure
to check the SupportsLayeredWindows global to determine if LayeredWindows
API is available.
History:
2001-10-11: Added UpdateLayeredWindow
2001-07-29: Initial version.
=========================================================================== }
{$I DFS.inc}
{$I BcDirectives.inc}
unit BcLayeredWindows;
interface
{$IFDEF MSWINDOWS}
uses Windows;
const
LWA_ALPHA = $00000002;
WS_EX_LAYERED = $00080000;
function SupportsLayeredWindows: Boolean;
type
TSetLayeredWindowAttributes = function(hWnd: THandle; crKey: TColorRef; bAlpha: Byte;
dwFlags: Cardinal): BOOL; stdcall;
TUpdateLayeredWindow = function(hWnd: THandle; hdcDst: HDC; pptDst: PPoint;
psize: PSize; hdcSrc: HDC; pptSrc: PPoint; crKey: TColorRef;
var blend: TBlendFunction; dwFlags: Cardinal): BOOL; stdcall;
var
UpdateLayeredWindow: TUpdateLayeredWindow = nil;
SetLayeredWindowAttributes: TSetLayeredWindowAttributes = nil;
{$ENDIF}
implementation
{$IFDEF MSWINDOWS}
var
User32Dll: HMODULE;
FSupportsLayeredWindows: Boolean;
function SupportsLayeredWindows: Boolean;
begin
Result := FSupportsLayeredWindows;
end;
initialization
User32Dll := LoadLibrary(user32);
FSupportsLayeredWindows := False;
if User32Dll <> 0 then
begin
UpdateLayeredWindow := GetProcAddress(User32Dll, 'UpdateLayeredWindow');
SetLayeredWindowAttributes := GetProcAddress(User32Dll, 'SetLayeredWindowAttributes');
FreeLibrary(User32Dll);
FSupportsLayeredWindows := Assigned(SetLayeredWindowAttributes);
end;
finalization
{$ENDIF}
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -