![]() |
Changing icons problem
Hi there.
I have a problem. When I change the default icon for some file extension, I need it to happen instantly. For example, I want to change icon for .cdc files. I know how to do it, and that is not a problem, but the problem is that it doesn't happen instantly, but when some kind of system refresh happens. I think it has something to do with shelliconcache.dll or iconcache.db, witch i can't find on my system. I have WXP Professional. For example, when you start BS Player and assign it to be the default player for some file types, it happens, and all icons change right away. I need to know what I can do to make this change happening when I want it. What is the thing that BS player and Windows Media Player do when they make a registry change, to make it happen at that exact moment? The thing is that i am creating an application that should be able to do this, and i have no idea what should be done, and how BS Player does it. Maybe I need to send some kind of system message to tell the OS to reload icon cache. Any help would be most appreciated. Thanks. |
|
@The Dark: I'd have to say, that link is far from useful.
I haven't been able to find a good answer. Odd. |
I know that the tweakUI powertool rebuilds your icons just for that purpose.
I think you need to do the same. |
@Dameon: Really? The first link off google (the codeproject one) shows a similar problem with changing the icons and shows the exact call needed to get the icon cache to be refreshed.
:
::SendMessage(HWND_BROADCAST ,I suspect that there is a better SPI_ value for icon changing, but this one (suposedly) does the trick. |
Guys, thank you all for helping, especially The Dark (again).
You got it right, but i still have a problem. ShellIconChanger really works, and it does what my app needs to do, but i have problems implementing the same in C#. Here is what happens: :
[DllImport("user32.dll")]:
RegistryKey k = Registry.CurrentUser.OpenSubKey("Control Panel").OpenSubKey("Desktop").OpenSubKey("WindowMetrics", true);Icons sometimes change immediately, and sometimes don't. From my app, icons change immediately only when I start it after doing the same thing in ShellIconChanger. Every other time app fails to do this. What am I missing? |
It may be the fault of another program you are running. If an app doesn't respond to the global SendMessage, it sits there waiting for it for a period of time. I am not sure what you can do about it though.
|
Use PostMessage instead?
Sorry about the criticism of the link. I seem to have missed the first result...somehow. |
It works! The SendMessageTimeout function does the trick.
:
private static extern long SendMessageTimeout(:
RegistryKey k = Registry.CurrentUser.OpenSubKey("Control Panel").OpenSubKey("Desktop").OpenSubKey("WindowMetrics", true);I still don't understand why the program never returned from SendMessage function, but it's not so important. Thanks a lot. |
| All times are GMT -5. The time now is 6:51 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC