procedure RefreshDesktop;
var
desktopHwnd: hWnd;
s: String;
begin
//Handle Desktop
desktopHwnd:= FindWindow('ProgMan', nil);
desktopHwnd:= GetWindow(desktopHwnd, GW_CHILD);
desktopHwnd:= GetWindow(desktopHwnd, GW_CHILD);
SetLength(s, 40);
GetClassName(desktopHwnd, PChar(S), 39);
if PChar(S) <> 'SysListView32' then desktopHwnd := 0;
//Refresh
PostMessage(desktopHwnd, WM_KEYDOWN, VK_F5, 0);
PostMessage(desktopHwnd, WM_KEYUP, VK_F5, 1 shl 31);
SendMessage(desktopHwnd, WM_COMMAND, $A065, 0);
InvalidateRect(desktopHwnd, nil, True);
end;
var
desktopHwnd: hWnd;
s: String;
begin
//Handle Desktop
desktopHwnd:= FindWindow('ProgMan', nil);
desktopHwnd:= GetWindow(desktopHwnd, GW_CHILD);
desktopHwnd:= GetWindow(desktopHwnd, GW_CHILD);
SetLength(s, 40);
GetClassName(desktopHwnd, PChar(S), 39);
if PChar(S) <> 'SysListView32' then desktopHwnd := 0;
//Refresh
PostMessage(desktopHwnd, WM_KEYDOWN, VK_F5, 0);
PostMessage(desktopHwnd, WM_KEYUP, VK_F5, 1 shl 31);
SendMessage(desktopHwnd, WM_COMMAND, $A065, 0);
InvalidateRect(desktopHwnd, nil, True);
end;
Contoh implementasi:
procedure TForm1.Button1Click(Sender: TObject);
begin
RefreshDesktop;
end;
begin
RefreshDesktop;
end;
0 comments:
Post a Comment