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
Solved

MFC: Color of dialog

Posted on 2010-09-15
3
413 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 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is an explanation of a simple data model to help parse a JSON feed
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
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…

839 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