Solved

MFC: Color of dialog

Posted on 2010-09-15
3
399 Views
Last Modified: 2013-11-20
Hiya

Can anybody how to determine the RGB value, at runtime, of the background colour of a dialog? Normally, it is something like 192, 192, 192 but I want to get the value in run time just in case the user has changed the default colour to something else.

John
0
Comment
Question by:IssacJones
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
Zoppo earned 250 total points
Comment Utility
Hi IssacJones,

you can use 'GetSysColor( COLOR_3DFACE )' to return the 'color for three-dimensional display elements and for dialog box backgrounds' (quote from MSDN) ...

Hope that helps,

ZOPPO
0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
If you require the individual red, green and blue colours the following will help:

The valid range for a normal RGB color is 0 to 16,777,215 (&H00FFFFFF).  The high byte of a number in this range always equals 0; the lower 3 bytes, from  least to most significant byte, determine the amount of red, green, and blue,  respectively. The red, green, and blue components are each represented by a  number between 0 and 255 (&HFF).
For example, the value 255 (&H000000FF) represents red, the value (65280  (&H0000FF00) represents green, and the value 16711680 (&H00FF0000)  represents blue.


0
 
LVL 30

Expert Comment

by:Zoppo
Comment Utility
Addition to Andy's comment: You can use GetRValue(), GetGValue() and GetBValue() to retrieve the single color components.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
hasOne  challenge 59 86
How to split this in C++ 4 76
countHi challenge 25 84
Non-recursive backtracking, using a stack 1 43
A short article about a problem I had getting the GPS LocationListener working.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now