关于使桌面图标透明的二个问题 (100分)

L

lvloj

Unregistered / Unconfirmed
GUEST, unregistred user!
使桌面图标透明的代码如下:
var wnd:HWND;
begin
Wnd := GetDesktopWindow;
Wnd := FindWindowEx(Wnd, 0, 'Progman', nil);
Wnd := FindWindowEx(Wnd, 0, 'SHELLDLL_DefView', nil);
Wnd := FindWindowEx(Wnd, 0, 'SysListView32', nil);
SendMessage(Wnd, $1026, 0, $ffffffff);
SendMessage(Wnd, $1024, 0, $00ffffff);
InvalidateRect(Wnd, nil, TRUE);
end;

以上代码在Win2000下工作不是很正常,运行后需要用运行屏幕保护之类的方法后
才能看到效果,请问:

1.如何修改才能使其在Win2000下和98下运行一样正常。
2.如何拦截桌面刷新的消息。
 
1>
uses Windows, CommCtrl;
function DZGetDesktopIconWindow: HWND;
begin
Result := FindWindow(PChar('Progman'), PChar('Program Manager'));
Result := FindWindowEx(Result, 0, PChar('SHELLDLL_DefView'), nil);
Result := FindWindowEx(Result, 0, PChar('SysListView32'), nil);
end;
procedure DZSetDesktopIconTransparent;
var
Desktop : HWND;
begin
Desktop := DZGetDesktopIconWindow;
ListView_SetTextBkColor(Desktop, MAXDWORD);
ListView_RedrawItems(Desktop, 0, Pred(ListView_GetItemCount(Desktop)));
UpdateWindow(Desktop);
end;

2>
function SetAutoArrange(Value: Boolean): boolean;
const
LVS_AUTOARRANGE = $0100;
var
Handle: THandle;
Style: DWORD;
begin
Result := False;
Handle := FindWindow('progman', nil);
Handle := GetWindow(Handle, GW_CHILD);
Handle := GetWindow(Handle, GW_CHILD);
if Handle <> 0 then
begin
Style := GetWindowLong(Handle, GWL_STYLE);
if Value then
Style := Style or LVS_AUTOARRANGE
else
Style := Style and (not LVS_AUTOARRANGE);
if SetWindowLong(Handle, GWL_STYLE, Style) <> 0 then
Result := True;
end;
end;

 
还是没有解决问题
 
好像是要拦截WM_ERASEBKGND消息
 
接受答案了.
 
顶部