update icons after registry change

Hi! I've successfully wrote to the registry a working
extension association (using internal identifiers and
everything) now I need to have all top level windows
update their icons to reflect this change.
I've tried all the related WM_xxx commands with the
sendmessage(HWND_BROADCAST function along with every
parameter combination possible. WM_SETTINGCHANGE comes
the closest to working - I see something try to happen
but no cigar. Maybe its all in the lParam but I've
tried all related registry keys. I've even considered
things such as sending the F5 key to all windows
or if I only knew explorers menu ID for 'Refresh'...
but then theres the risk of obvious havoc from other
apps. And using FindWindow to find all explorers is a
trick too because the caption contains its current
path. Even all this is no good because of the need to
update desktop icons and such.
I've seen other apps do global refreshs and icon
rebuilds before, and Windows itself does a snappy job
of this when setting associations through its own
filetype editing dialog.
What gets me is that it must be something simple...
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Thus this work?
procedure TForm1.Button1Click(Sender: TObject);
                               SendMessage(FindWindow('Progman', 'Program Manager'), WM_COMMAND,
                          106597, 0);
amber45Author Commented:
Hi ZifNab! no, it didnt work. it looks as though the desktop
gets refreshed a little bit but no icons change. I put a wav
file right on my desktop to work with. but the only way it will
update is if I highlight it and hit F5.
The explorer remains untouched.
If I run your snip again and again, windows seems to do some
kind of bigger refresh eventually that does it OK, but even
then not every time.

What does the '106597' stand for - a menu ID? I knew the old
Program Manager still resides somewhere deep in 95 but I didnt
know you could still send it messages. Is it embedded into the
desktop now or something? I know I can run progman.exe and stuff
but how is it already running and eccepting messages otherwise?
Very interesting in all but this seems like the wrong direction.
Thanks for trying!
amber45Author Commented:
Is this one too tough for the experts???
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

I've not tried this, but how about doing an


amber45Author Commented:
just tried it and it doesnt work. I'm also trying RedrawWindow
but that doesnt seem to work either although I'm not sure if I
have it coded right. Has anybody successfully used the
RedrawWindow command? Both this and the UpdateWindow uses the
WM_PAINT message which I'm not even sure refreshes icons.


i think this is working =)

amber45Author Commented:
sorry k6, tried that too. I even wrote to the win.ini the
correct data and everything as well. still nothing.
I'm starting to think this must be some kind of secret microsoft
command or something...

I've tried all this on several machines to make sure its not a
fault of my machine - but if anybody has tried anything here and
made it work on yours, be sure to let me know! ;)
Hi amber45,

found this somewhere on the net, give it a try :

this seems to work:

                             procedure Tfrom1.updateicons;
                             var dtwh : hwnd;
                                 p1, p2 : pchar;
                                 s1, s2 : string;
                               s1 := 'Progman';
                               s2 := 'Program Manager';

                               getmem(p1, length(s1)+1);
                               getmem(p2, length(s2)+1);
                               strpcopy(p1, s1);
                               strpcopy(p2, s2);

                               dtwh := FindWindow(p1,p2);

                               freemem(p1, length(s1)+1);
                               freemem(p2, length(s2)+1);

                               sendmessage(dtwh, wm_command, $A065, 0);

amber45Author Commented:
hey Zif! isnt that essentially the same as your first response?
only the wparam differs. Do you think focusing on the progman thing is still the key? it still doesnt work although playing
with that wparam value does some very interesting things!

The closest to actually refreshing anything comes from this:

sendmessage(hwnd_broadcast, WM_command, $A065, 0);

it seems as though your $A065 does indeed refresh drive data and
tree views in explorers, but not the file list or icons.
It doesnt seem to do anything when used with the progman thing.
Does it really work for you?

playing around I found a couple other params that effect explorer
when used with the above line of code-
$A062 will hide the toolbar and A063 hides the status bar. :]

Still these seem to all be explorer recognized commands. The
desktop and the rest of windows remains untouched.

I'm still curious about the Program Manager reference you make
and how its involved, Zif. Whats the dilly?

You must call

uses  ShlObj;



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
amber45Author Commented:
Thats it, timop!!!!!!! I didnt know of the SHChangeNotify...
lots of other neat flags in there too! I'm also going to have to
take a deep look into shlobj.

Thanks a ton, timop, I wish I could buy you a beer! but
the points will have to do for now! and thanks everyone for your
suggestions. (I'd still like to know what else you know about
the progman thing, Zif :)


amber, not much... Glad prob. is solved now, have a nice day, Zif.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.