How to rebuild iconcache like this software:Rebic?

see:http://www.virtualplastic.org/html/icn_sys.html#2

Rebuild the icon cache
This is a feature of some of these and other apps. What's being done is, the hidden "shelliconcache" file (no extension, and a hidden file) in your windir gets deleted. This cache gets corrupted once in a while. You can do that yourself but you'll need to restart to refresh explorer, and to recreate the file. This function refreshes explorer and the file immediately.

It's also available as a standalone program. RebIC removes any old images from memory and is available from ArcaneWooD Software (free, Win 9x). Great when you've been fooling around without using any app: put a shortcut in your quicklaunch bar (add "-close" to the path).

 
MonkeyLinAsked:
Who is Participating?
 
KDivadConnect With a Mentor Commented:
What are GetStringValue and SetStringValue?

Other than that, it looks about right... I just tried it. I used regedit to make a change and then used BROADCAST, but the desktop did not update. I don't know if I have a wrong constant or wrong API...

I'd suggest:

Posting a low-point (50?) Q with a question on how to tell explorer that the settings has changed. If you get an answer that works, you can come back and either delete or reduce the number of points (make a post in Community Service) for this Q.

What we need:
1. Lock desktop. Have it.
2. Make change. Have it.
3. Broadcast change. Need it.
4. Make change. Have it.
5. Braodcast change. Need it.
6. Unlock desktop. Have it.

That I remember for 100% sure. If someone could tell how to broadcast the change, you'd have your code.
0
 
KDivadCommented:
Easy, though I've lost the source to a control I built this into. The idea is as follows:

1. Modify the "Shell Icon Size" value in the registry in the key "HKCU\Control Panel\Desktop\WindowMetrics".
2. Use SendMessage to tell the system that a system metric has been altered (constant unknown).
3. Restore the value from step 1.
4. Repeat step 2.

I'll see if I can find my actual code, but I'm pretty sure I've lost it.
0
 
KDivadCommented:
Nope, I don't see it anywhere. The control I used it in is apparently all I have left of it. Since it's compiled to Native code, I can't retrieve it either... <sigh>
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
MonkeyLinAuthor Commented:
Good!And now,I only want to know: How to tell the system that a system metric has been altered...
kDivad,Thank you!
0
 
KDivadCommented:
If I can remember it, I'll let you know. But I've had no luck so far. I've been trying to rewrite that component and this is the only thing I haven't yet figured out...
0
 
MonkeyLinAuthor Commented:
I'll waiting ...Thank you!
0
 
KDivadCommented:
I did remember another part. You need to lock the desktop before the code executes to prevent massive flickering.

Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Long) As Long
Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Long

LockWindowUpdate GetDesktopWindow
'Do the flushing from earlier post
LockWindowUpdate 0

Still trying to find or remember that code...
0
 
MonkeyLinAuthor Commented:
Still waiting...
0
 
KDivadCommented:
I think I've got part of it. I've got another constant to track down before I can try it though.

Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const HWND_BROADCAST = &HFFFF&
0
 
KDivadCommented:
It was supposed to be:

Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const HWND_BROADCAST = &HFFFF&
0
 
KDivadCommented:
This may be it:

Public Const WM_WININICHANGE = &H1A

I'll give it a shot tomorrow, I've got to get to bed...
0
 
KDivadCommented:
Nope, not it. Or at least, it's partially not it. Will keep looking.
0
 
MonkeyLinAuthor Commented:
It's the code right?
when I use the code, program die??
Private Const WM_WININICHANGE = &H1A
Private Const WM_SETTINGCHANGE = WM_WININICHANGE
Private Const HWND_BROADCAST = &HFFFF&
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Sub Command1_Click()
Dim tmpstr As String
tmpstr = GetStringValue("HKEY_CURRENT_USER\Control Panel\desktop\WindowMetrics", "Shell icon size")
SetStringValue "HKEY_CURRENT_USER\Control Panel\desktop\WindowMetrics", "Shell icon size", CStr(CLng(tmpstr) + 1)
SendMessage HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0
SetStringValue "HKEY_CURRENT_USER\Control Panel\desktop\WindowMetrics", "Shell icon size", tmpstr
SendMessage HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0
End Sub
0
 
MonkeyLinAuthor Commented:
Keep waiting...
0
 
MonkeyLinAuthor Commented:
I know how to do it!!!
Do not use
SendMessage HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0
Try this:
whwnd = FindWindow("progMan", "program manager")'GetDesktop?
SendMessage whwnd, WM_SETTINGCHANGE, 0, 0

This problem is too hard.It take me about three month's time.I'm so happy now.

Thank you for your help!!!

Well,GetStringValue and SetStringValue are custom Functions.

Thank you again!!
0
 
MonkeyLinAuthor Commented:
Really thank you!
0
 
KDivadCommented:
It works now? Awesome! Congratulations! Now, I can finally finish rebuilding that project.

We both got what we needed from this one. Makes the trouble worth it, doesn't it?

Later,
KDL
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.