win2k.pas
来自「模仿WindowsXP界面」· PAS 代码 · 共 57 行
PAS
57 行
unit Win2k;
interface
uses
Windows;
const
WS_EX_LAYERED = $00080000;
LWA_ALPHA = $00000002;
type
FAnimateWindow = function(const hwnd: HWND; const dwTime: DWORD; const dwFlags: DWORD):DWORD; stdcall;
FSetLayeredWindowAttributes = function(hWnd: HWND; crKey: DWORD; bAlpha: Byte; dwFlags: DWORD): BOOL; stdcall;
function AnimateWindow(const hwnd: HWND; const dwTime: DWORD; const dwFlags: DWORD):DWORD;
function SetLayeredWindowAttributes(hwnd: HWND; crKey: DWORD; bAlpha: Byte; dwFlags: DWord): BOOL;
implementation
function AnimateWindow(const hwnd: HWND; const dwTime: DWORD; const dwFlags: DWORD):DWORD;
var
DLLHandle : THandle;
AnimateWindow : FAnimateWindow;
begin
Result := 0;
DLLHandle := LoadLibrary('user32.dll');
if DLLHandle <> 0 then begin
@AnimateWindow := GetProcAddress(DLLHandle,'AnimateWindow');
if @AnimateWindow <> nil then begin
Result := AnimateWindow(hwnd,dwTime,dwFlags);
end;
end;
end;
function SetLayeredWindowAttributes(hwnd: HWND; crKey: DWORD; bAlpha: Byte; dwFlags: DWORD): BOOL;
var
DLLHandle : THandle;
gwlStyle : Longint;
SetLayeredWindowAttributes : FSetLayeredWindowAttributes;
begin
Result := false;
DLLHandle := LoadLibrary('user32.dll');
if DLLHandle <> 0 then begin
@SetLayeredWindowAttributes := GetProcAddress(DLLHandle,'SetLayeredWindowAttributes');
if @SetLayeredWindowAttributes <> nil then begin
gwlStyle := GetWindowLong(hwnd,GWL_EXSTYLE);
gwlStyle := gwlStyle or WS_EX_LAYERED;
SetWindowLong(hwnd,GWL_EXSTYLE,gwlStyle);
Result := SetLayeredWindowAttributes(hWnd,crKey,bAlpha,dwFlags);
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?