Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleSet the desktop icon size
Keywordsdesktop icon size, Registry, regedit
CategoriesTips and Tricks, Windows
 
!!! WARNING !!!
Modifying the Registry can seriously damage your system. If you change the wrong values, you can make your system unbootable. Don't mess with the registry unless you know what you are doing and make a backup first in any case.

Use the SetRegKeyValue function to set the value of the "Control Panel\Desktop\WindowMetrics\Shell Icon Size" Registry value. See the code for details of how SetRegKeyValue works.

Then use SendMessageTimeout to broadcast a message to all toplevel windows telling them a system setting has changed. That makes them update their icons.

For best results, set the icon size to 32 or 16, although it's interesting to set it to 4 and 64 just to see what happens.

 
' Set the icon size.
Private Sub cmdSetSize_Click()
Dim result As Long

    ' Set the icon size.
    SetRegKeyValue HKEY_CURRENT_USER, _
        "Control Panel\Desktop\WindowMetrics", _
        "Shell Icon Size", txtSize.Text

    ' Send HWND_BROADCAST to refresh the icons.
    SendMessageTimeout HWND_BROADCAST, WM_SETTINGCHANGE, _
        SPI_SETNONCLIENTMETRICS, 0&, SMTO_ABORTIFHUNG, _
        10000&, result
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated