Solved

MFC: Color of dialog

Posted on 2010-09-15
3
425 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 250 total points
ID: 33683613
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
ID: 33684242
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 31

Expert Comment

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

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
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…
Starting up a Project

724 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