bjay55 Posted April 6, 2005 Posted April 6, 2005 I have changed the desktop color value at - HKEY_CURRENT_USER\Control Panel\Colors\Background in the registry, but to get change to take effect I have to restart the computer. How would I make the change take effect without restarting the computer. Thanks in advance for any help. Quote
Leaders snarfblam Posted April 7, 2005 Leaders Posted April 7, 2005 There are Windows APIs to change the system colors what will automatically refresh everything to ensure that colors are drawn correctly. Have some links. GetSysColor: http://www.mentalis.org/apilist/GetSysColor.shtml SetSysColors: http://www.mentalis.org/apilist/SetSysColors.shtml Quote [sIGPIC]e[/sIGPIC]
bjay55 Posted April 7, 2005 Author Posted April 7, 2005 Still having trouble I declared the setsyscolors function Private Declare Function SetSysColors Lib "user32" (ByVal nChanges As Long, ByVal lpSysColor As Long, ByVal lpColorValues As Integer) As Long then used this code but the desktop color does not change color. Dim ret As Long Const COLOR_BACKGROUND = 1 ret = SetSysColors(1, COLOR_BACKGROUND, RGB(100, 100, 100)) the function returns the number 8975933078237085696. Am I doing something wrong. Would greatly appreciate your help. Quote
bjay55 Posted April 7, 2005 Author Posted April 7, 2005 Got it! Hey, I got it working. I had declared the function wrong. this did not work: Declare Function SetSysColors Lib "user32" (ByVal nChanges As Long, ByRef lpSysColor As Long, ByRef lpColorValues As Long) As Long this worked: Declare Function SetSysColors Lib "user32" (ByVal nChanges As Integer, ByRef lpSysColor As Integer, ByRef lpColorValues As Integer) As Integer Quote
Leaders snarfblam Posted April 7, 2005 Leaders Posted April 7, 2005 Sorry, I should have mentioned that the site gives VB6 declarations, not .Net. Quote [sIGPIC]e[/sIGPIC]
bjay55 Posted April 7, 2005 Author Posted April 7, 2005 Thanks Thats ok, thaks for your help. Greatly appreciated. Quote
Recommended Posts