How do I reload the icons on the desktop ?

I want to change the default Desktop directory, so that the
icons of an other directory are shown on the Desktop.

I know how to change the Desktop directory in the Registry. But after changing this, I still need to reload the desktop to show the icons of the new directory but HOW CAN I DO THIS ????

Please help...
dms@Asked:
Who is Participating?
 
mirek071497Connect With a Mentor Commented:
Hi

Mayby this is not very fine however this is working solution.

uses
  Registry;

procedure TForm1.Button1Click(Sender: TObject);
var
  reg : TRegistry;
  st  : string;
begin
  reg := TRegistry.Create;
  if reg.OpenKey('Control Panel\desktop\WindowMetrics', false) then
    begin
      st := reg.readstring('Shell Icon Size');
      reg.writestring( 'Shell Icon Size', IntToStr(StrToInt(st)+1) );
      SendMessage( hwnd_broadcast, WM_SETTINGCHANGE, 0, 0 );
      reg.writestring( 'Shell Icon Size', st );
    end;
  reg.free;
end;

0
 
WaldekCommented:
Maybe this:
RedrawWindow(0,nil,0,RDW_ERASE or RDW_ALLCHILDREN or RDW_INVALIDATE);
but i think , this redraw desktop but information about change desktop directory is not loaded from registry
0
 
dms@Author Commented:
The thing Waldek suggested doesn't work, because it doesn't reload the icons, but just redraws them.
0
 
kangadruCommented:
Try using SHChangeNotify.  It is documented in the ShlObj.pas file.  You have to notify the system that thepaths and shell Icons has changed.

Andy

0
 
mirek071497Commented:
Hi
I see so this is the second question with the same problem. Do you give me the points too if I found how to do this in delphi ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.