デスクトップのアイコンのテキストの背景を透過させる関数です。この関数は直接透過させる関数ではなく、背景の色を変更する関数です。NewColor引数に-1を設定することで背景を透過させることができます。
なお、uses節にCommctrlを追加しておいてください。
procedure SetDesktopIconBKColor(NewColor: TColor);
var
hSysListView: THandle;
begin
hSysListView := FindWindow('Progman', 'Program Manager');
if hSysListView <> 0 then
begin
hSysListView := FindWindowEx(hSysListView, 0, 'SHELLDLL_DefView', nil);
if hSysListView <> 0 then
begin
hSysListView := FindWindowEx(hSysListView, 0, 'SysListView32', nil);
if hSysListView <> 0 then
begin
NewColor := ColorToRGB(NewColor);
SendMessage(hSysListView, LVM_SETTEXTBKCOLOR, 0, NewColor);
InvalidateRect(hSysListView, nil, True);
end;
end;
end;
end;
|