桌面圖標太多的時候總是顯示不開,但是在Windows裡面查看很多文件的時候可以列表形式查看,但是桌面不行了,所以我自己研究了一下,寫了一個桌面圖標列表查看的工具
這個工具運行第一次是列表查看,再運行就是正常查看,非常簡單程序運行後便結束,不會占用內存,加載在啟動裡面這樣每次進入桌面圖標便會是列表方式查看了
兩種查看方式的對比
program Project1;
//作者:孫占偉
//[email protected]
uses
Windows,
SysUtils;
function GetDesktopHwnd(): HWND;
var
hWin: HWND;
bufClassName: array[0..255] of Char;
begin
//取得窗體的HWND
hWin := FindWindow('Progman', nil);
//取得窗體的下一個HWND
hWin := GetWindow(hWin, GW_CHILD);
GetClassName(hWin, bufClassName, 255);
while Trim(bufClassName) <> 'SHELLDLL_DefVIEw' do
begin
if hWin <> 0 then
begin
hWin := GetNextWindow(hWin, GW_HWNDNEXT);
GetClassName(hWin, bufClassName, 255);
end
else
begin
Result := hWin;
Exit;
end;
end;
hWin := GetWindow(hWin, GW_CHILD);
GetClassName(hWin, bufClassName, 255);
while Trim(bufClassName) <> 'SysListVIEw32' do
begin
if hWin <> 0 then
begin
hWin := GetNextWindow(hWin, GW_HWNDNEXT);
GetClassName(hWin, bufClassName, 255);
end
else
begin
Result := hWin;
Exit;
end;
end;
OutputDebugString(PChar(IntToStr(hWin)));
Result := hWin;
end;
procedure SetDesktopSmallIcon();
var
hWin: HWND;
WinStyle: Integer;
begin
hWin := GetDesktopHwnd;
if hWin <> 0 then
begin
WinStyle := GetWindowLong(hWin, GWL_STYLE);
SetWindowLong(hWin, GWL_STYLE, (WinStyle xor $0002));
end;
end;
begin
SetDesktopSmallIcon();
end.