...refresh the desktop?

Author: Thomas Stutz

Category: Misc

{1.}

uses
  
ShlObj;

procedure RefreshDesktop1;
begin
  
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nilnil);
end;

{2.}

procedure RefreshDesktop2;
var
  
hDesktop: HWND;
begin
  
hDesktop := FindWindowEx(FindWindowEx(FindWindow('Progman', 'Program Manager'), 0,
    'SHELLDLL_DefView', ''), 0, 'SysListView32', '');
  PostMessage(hDesktop, WM_KEYDOWN, VK_F5, 0);
  PostMessage(hDesktop, WM_KEYUP, VK_F5, 1 shl 31);
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base