Solved

How to rebuild iconcache like this software:Rebic?

Posted on 2001-08-04
17
244 Views
Last Modified: 2012-06-21
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).

 
0
Comment
Question by:MonkeyLin
  • 10
  • 7
17 Comments
 
LVL 5

Expert Comment

by:KDivad
ID: 6352649
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
 
LVL 5

Expert Comment

by:KDivad
ID: 6352652
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
 

Author Comment

by:MonkeyLin
ID: 6352710
Good!And now,I only want to know: How to tell the system that a system metric has been altered...
kDivad,Thank you!
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6352833
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
 

Author Comment

by:MonkeyLin
ID: 6353035
I'll waiting ...Thank you!
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6353942
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
 

Author Comment

by:MonkeyLin
ID: 6354311
Still waiting...
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6355095
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 5

Expert Comment

by:KDivad
ID: 6355100
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
 
LVL 5

Expert Comment

by:KDivad
ID: 6355107
This may be it:

Public Const WM_WININICHANGE = &H1A

I'll give it a shot tomorrow, I've got to get to bed...
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6357739
Nope, not it. Or at least, it's partially not it. Will keep looking.
0
 

Author Comment

by:MonkeyLin
ID: 6357805
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
 

Author Comment

by:MonkeyLin
ID: 6357835
Keep waiting...
0
 
LVL 5

Accepted Solution

by:
KDivad earned 200 total points
ID: 6357877
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
 

Author Comment

by:MonkeyLin
ID: 6357913
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
 

Author Comment

by:MonkeyLin
ID: 6357931
Really thank you!
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6358118
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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now