Changing the system palette in Windows NT

I'm developing an application which needs a "Night Display". The "Night Display" should be able to change the colors for every application in Windows NT (including Desktop, Mouse Icon, Taskbar....) I could change the color of every single object, but that is not satisfactory. The functionality I'm looking for is very much like the functionality in the Control Panel. I need to be able to change the Scheme and colors for every item. Preferably I would like to be able to save/read these settings on/from a file.
OTveitAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nIcebearCommented:
I'm sure the colors are stored in the Registry. Export your registry (eg. into before.reg), change the colors and export it again (eg. into after.reg). Look up, which values are changing (eg. with WinDiff - thats a free tool from Microsoft coming with Win98). If you know which values to change you can write them into the registry.

PS: There's surely a better method to do this with some API-call (which I do not know).
0
mcriderCommented:
Check out these microsoft KB articles:

How to Set Windows System Colors Using API and Visual Basic
http://support.microsoft.com/support/kb/articles/Q82/1/58.ASP 
 
HOWTO: Use Custom System Colors Only When Your App Has Focus
http://support.microsoft.com/support/kb/articles/Q186/0/62.ASP?LNG=ENG&SA=MSDN 
 

The article "How to Set Windows System Colors Using API and Visual Basic" is a VB3 example, but it still works in VB5/VB6... All you have to do is use the 32-BIT API calls instead of the 16-BIT called in the example...


Cheers!

0
OTveitAuthor Commented:
I tried using SetSysColor and GetSysColor, but it does not quite satisfy my needs.

Problem 1: I can't get GetSysColor to work properly. It always returns 0.

Problem 2: I can't change the color of the mouse icon.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

cvidlerCommented:
You can't change the color of the mouse pointer - to do this you would have to load a new .cur file made witht he colours you want...

As for prob 1 I have not had any problems with NT4, Win2k, and Win9x (I have access to all these - great for testing)
0
RuchiCommented:
Try this one.

Module::

Option Explicit

Private Declare Function GetSysColor Lib "user32" (ByVal nindex As Long) As Long
Private Declare Function SetSysColors Lib "user32" (ByVal nChanges As Long, lpSysColor As Long, lpColorValues As Long) As Long
Public Enum WindowsItem
    COLOR_ACTIVEBORDER = 10
    COLOR_ACTIVECAPTION = 2
    COLOR_APPWORKSPACE = 12
    COLOR_BACKGROUND = 1
    COLOR_BTNFACE = 15
    COLOR_BTNHIGHLIGHT = 20
    COLOR_BTNSHADOW = 16
    COLOR_BTNTEXT = 18
    COLOR_CAPTIONTEXT = 9
    COLOR_GRAYTEXT = 17
    COLOR_HIGHLIGHT = 13
    COLOR_HIGHLIGHTTEXT = 14
    COLOR_INACTIVEBORDER = 11
    COLOR_INACTIVECAPTION = 3
    COLOR_INACTIVECAPTIONTEXT = 19
    COLOR_MENU = 4
    COLOR_MENUTEXT = 7
    COLOR_SCROLLBAR = 0
    COLOR_WINDOW = 5
    COLOR_WINDOWFRAME = 6
    COLOR_WINDOWTEXT = 8
End Enum

Public Function GetWindowsColor(Item As WindowsItem) As OLE_COLOR
    GetWindowsColor = GetSysColor(Item)
End Function

Public Sub SetWindowsColor(Item As WindowsItem, Color As OLE_COLOR)
    SetSysColors 1, Item, Color
End Sub



Form::

Option Explicit

Private Sub Combo1_Click()
    Shape1.FillColor = GetWindowsColor(Combo1.ListIndex)
End Sub

Private Sub Command1_Click()
    CommonDialog1.CancelError = True
    On Error GoTo ErrHandler
    CommonDialog1.ShowColor
    Shape1.FillColor = CommonDialog1.Color
    SetWindowsColor Combo1.ListIndex, Shape1.FillColor
ErrHandler:
End Sub

Private Sub Form_Load()
    Combo1.AddItem "Scroll Bar"
    Combo1.AddItem "Background"
    Combo1.AddItem "Active Caption"
    Combo1.AddItem "Inactive Caption"
    Combo1.AddItem "Menu"
    Combo1.AddItem "Window"
    Combo1.AddItem "Window Frame"
    Combo1.AddItem "Menu Text"
    Combo1.AddItem "Window Text"
    Combo1.AddItem "Caption Text"
    Combo1.AddItem "Active Border"
    Combo1.AddItem "Inactive Border"
    Combo1.AddItem "App Workspace"
    Combo1.AddItem "Highlight"
    Combo1.AddItem "Highlight Text"
    Combo1.AddItem "Button Face"
    Combo1.AddItem "Button Shadow"
    Combo1.AddItem "Gray Text"
    Combo1.AddItem "Button Text"
    Combo1.AddItem "Inactive Caption Text"
    Combo1.AddItem "Button HighLight"
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OTveitAuthor Commented:
I still don't know how to change the color of the mouse pointer. I understand that I need to load a different .cur file but how can I do this so it takes effect immediately for the hole system? If I set the Mouse Pointer property to Custom, and loads a .cur file, it only works for that specific form (also not for the title bar). If I change the cursor file in the Registry (I haven't got this to work yet) I guess this won't take effect until I reboot....?
0
cvidlerCommented:
the mouse pointer can be changed using the API (can't remember right now) which will make a system-wide change to the cursor (just like you changed them in the Mouse control panel applet)


0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.