⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xdesktop.pas

📁 关于c++ builder编程的很好的资料
💻 PAS
字号:
unit xDesktop;

interface

uses Windows, Messages, SysUtils, Forms, Controls, Graphics, ShellAPI, Registry;

function GetDesktopDefView: HWND;
function GetDesktopListView: HWND;
function GetActiveDesktopWindow: HWND;

procedure RebuildIconCache;


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;


end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -