📄 xdesktop.pas
字号:
unit xDesktop;
interface
uses Windows, Messages, SysUtils, Forms, Controls, Graphics, ShellAPI, Registry;
function GetDesktopDefView: HWND;
function GetDesktopListView: HWND;
function GetActiveDesktopWindow: HWND;
procedure RebuildIconCache;
function IsScreenSaverRunning(KillIt: Boolean): Boolean;
implementation
uses xStrings, xFiles;
function GetDesktopDefView: HWND;
begin
Result := GetWindow(FindWindow(PChar('ProgMan'), nil), GW_CHILD);
end;
function GetDesktopListView: HWND;
begin
Result := GetWindow(GetWindow(FindWindow(PChar('ProgMan'), nil), GW_CHILD), GW_CHILD);
end;
function GetActiveDesktopWindow: HWND;
var
Buf: array[0..255] of Char;
begin
Result := GetDesktopListView;
repeat
Result := GetWindow(Result, GW_HWNDNEXT);
if Result = 0 then Exit;
GetClassName(Result, Buf, 256);
until StrIComp(Buf, 'Internet Explorer_Server') = 0;
end;
procedure RebuildIconCache;
var
IconW: Integer;
begin
IconW := GetSystemMetrics(SM_CXICON);
with TRegIniFile.Create('Control Panel\Desktop') do
try
WriteString('WindowMetrics', 'Shell Icon Size', IntToStr(IconW - 1));
SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, 0);
WriteString('WindowMetrics', 'Shell Icon Size', IntToStr(IconW));
SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, 0);
finally
Free;
end;
end;
function IsScreenSaverRunning(KillIt: Boolean): Boolean;
var
hd: HDESK;
hw: HWND;
PT: TPoint;
begin
Result := False;
if Win32Platform = VER_PLATFORM_WIN32_NT then { Windows NT }
begin
// 棵辊玂臔祘Α┮
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -