Solved

How to rebuild iconcache like this software:Rebic?

Posted on 2001-08-04
17
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we 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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month6 days, 13 hours left to enroll

623 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