Update Windows

Posted on 1999-07-26
Medium Priority
Last Modified: 2010-04-30
I want to change the Windows system colors from within my program, but I can't get Windows to update itself to acknowledge the changes.
Question by:microfleet
LVL 12

Expert Comment

ID: 1527568
Ummm, I think I know this one. You have to kill and restart Explorer as I recall. The colors and other screen settings are read at initial load and not subsequiently. This forces a re-read of the registry without requiring a full stop. When you tell explorer to terminate it will fire the <Stop>/<Restart>/<Cancel> dialog, Select <Cancel> and Explorer will die & autorestart without closing the machine. I've never tried to do that programmatically, but it should work. It works if you <End Task> from <Ctrl/Alt/Del>.


LVL 10

Accepted Solution

viktornet earned 400 total points
ID: 1527569
use the SetSysColors() function to change those colors.... then try calling the following sub..

sub RefreshDesktop()
  dim i as long

  call PostMessage(i,WM_KEYDOWN,VK_F5,0)
  call PostMessage(i,WM_KEYUP,VK_F5, 2^31)
end sub

This should do it...


Author Comment

ID: 1527570
Thanks viktornet, the SetSysColor did the trick all on its own. I couldnt be happier. You get the points for simply pointing out that function. I havent tried the RefreshDesktop procedure yet, but I have no doubt it will work.

Thanks again!

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As a person who answers a lot of questions, I often see code that could be simplified, made easier to read, and perhaps most importantly made easier to maintain if the code was modified to use the Select Case statement. This article explains how to…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

627 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