Moretti, Windows stores the colour information in the registry on a per user basis. The user information registry key starts with HKEY_USERS. Under HKEY_USERS, there should be at least 3 sub keys, .DEFAULT and for each user in the system, a pair of keys made up of the internal GUID userID of the user. I am assuming Win2K + here, but Win98 is similar. For the process' user, this information is also reflected in HKEY_CURRENT_USER. To change the current user's settings, go to the key HKEY_CURRENT_USER\Control Panel\Colors, and modify any of the named values inside that key. Eg. the "WindowText" value specifies the default foreground colour. Data is stored as a space-separated value string. The first value is the red component, followed by green then blue. Valid values are from 0 to 255.
Modifications to HKEY_USERS\.DEFAULT\Control Panel\Colors only affect new users, or existing users who create a new profile for themselves on the machine. After changing the registry setting(s), you must send the WM_SETTINGCHANGE message. This informs all top level windows to refresh themselves. If you forget to send this message, it is possible for some windows to remain in the old colour while others (especially new windows) display in the new colours. Regards, Dennis. ----- Original Message ----- From: "Moretti, Giovanni" <[EMAIL PROTECTED]> To: "Dennis Chuah" <[EMAIL PROTECTED]> Sent: Tuesday, June 10, 2003 10:44 AM Subject: Setting Windows Scheme Colours from Delphi - how? Hi Dennis > Firstly, you need to ask yourself where it is desirable to alter the > Windows default colours from your app. The usual way, as you say, > is via the control panel. Users could be confused and irritated if > your app changes those colours without their knowledge. > ... Unless of course, the purpose of the software is to allow users > change those Windows settings. > If you can convince me why you would want to add this "feature" > to your software, I'll tell you the Windows API calls to make. Yes, I know it's probably not a good idea in production software, however this is part of my PhD research on the feasibility of generating harmonious colour schemes, semi-automatically. Part of this is to make the colour of windows "agree" with surrounding object including the background, window borders ... I'm not sure that changing the overall colour scheme is desirable, but I'd like to be able to have tried it and then be able to state "for the record" that users found it disturbing (or not), rather than just assuming they will. Reason enough ... Thanks Giovanni ======================================================================== Giovanni Moretti | Institute of Information Sciences and Technology Senior Lecturer | Massey University, Palmerston North, New Zealand Computer Science | Ph 64-6-3505799x2474 == Fax 64-6-3502259 == ZL2BOI ------------------------------------------------------------------------ http://www-ist.massey.ac.nz/moretti mailto:[EMAIL PROTECTED] --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
