Click here to Skip to main content
16,016,781 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralLaunching another app from C++ program Pin
Laser113-Aug-05 13:21
Laser113-Aug-05 13:21 
GeneralRe: Launching another app from C++ program Pin
David Crow13-Aug-05 15:57
David Crow13-Aug-05 15:57 
GeneralText color from background color Pin
Ravi Bhavnani13-Aug-05 12:05
professionalRavi Bhavnani13-Aug-05 12:05 
GeneralRe: Text color from background color Pin
cpprules13-Aug-05 12:39
cpprules13-Aug-05 12:39 
GeneralRe: Text color from background color Pin
Ravi Bhavnani14-Aug-05 5:04
professionalRavi Bhavnani14-Aug-05 5:04 
GeneralRe: Text color from background color Pin
John R. Shaw13-Aug-05 18:40
John R. Shaw13-Aug-05 18:40 
GeneralRe: Text color from background color Pin
Ravi Bhavnani14-Aug-05 5:04
professionalRavi Bhavnani14-Aug-05 5:04 
GeneralSolution Pin
Ravi Bhavnani14-Aug-05 5:02
professionalRavi Bhavnani14-Aug-05 5:02 
I ended up using a modified version of the brightness algorithm.

//! Retrieves an appropriate text (foreground) color for a specific
//! background color.
//! @param  rgbBkgColor Background color.
//! @return Foreground color.
COLORREF CDlgWeatherMate::getTextColor
  (COLORREF rgbBkgColor)
{
  COLORREF rgbText = RGB (255, 255, 255);
  int nRed = GetRValue (rgbBkgColor);
  int nGreen = GetGValue (rgbBkgColor);
  int nBlue = GetBValue (rgbBkgColor);
 
  int nBrightness = (nRed*299 + nGreen*587 + nBlue*114) / 1000;
  if (nBrightness > 150)
     rgbText = RGB (0, 0, 0);
 
  // Exception(s)
  if (rgbText == RGB (255, 255, 255)) {
      if ((nRed == 0) && (nBlue == 0) && (nGreen > 153))
         rgbText = RGB (0, 0, 0);
  }
 
  return (rgbText);
}
/ravi

My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com

GeneralRe: Solution Pin
Jack Puppy14-Aug-05 10:39
Jack Puppy14-Aug-05 10:39 
GeneralRe: Solution Pin
Ravi Bhavnani15-Aug-05 1:54
professionalRavi Bhavnani15-Aug-05 1:54 
GeneralRe: Solution Pin
Ravi Bhavnani15-Aug-05 16:57
professionalRavi Bhavnani15-Aug-05 16:57 
GeneralTask List problem Pin
cpprules13-Aug-05 11:52
cpprules13-Aug-05 11:52 
GeneralRe: Task List problem Pin
John R. Shaw13-Aug-05 19:14
John R. Shaw13-Aug-05 19:14 
GeneralRe: Task List problem Pin
S. Senthil Kumar14-Aug-05 3:37
S. Senthil Kumar14-Aug-05 3:37 
GeneralRe: Task List problem Pin
S. Senthil Kumar14-Aug-05 3:39
S. Senthil Kumar14-Aug-05 3:39 
GeneralManaging Memory Pin
deus78913-Aug-05 11:49
deus78913-Aug-05 11:49 
GeneralRe: Managing Memory Pin
John R. Shaw13-Aug-05 19:49
John R. Shaw13-Aug-05 19:49 
GeneralRe: Managing Memory Pin
S. Senthil Kumar14-Aug-05 3:45
S. Senthil Kumar14-Aug-05 3:45 
GeneralCAsyncSocket Pin
xSoptik13-Aug-05 10:18
xSoptik13-Aug-05 10:18 
GeneralRe: CAsyncSocket Pin
S Douglas15-Aug-05 1:47
professionalS Douglas15-Aug-05 1:47 
GeneralWindow sizing by actual string and font Pin
xSoptik13-Aug-05 9:53
xSoptik13-Aug-05 9:53 
GeneralRe: Window sizing by actual string and font Pin
PJ Arends13-Aug-05 10:07
professionalPJ Arends13-Aug-05 10:07 
General*char problem Pin
Axonn Echysttas13-Aug-05 9:09
Axonn Echysttas13-Aug-05 9:09 
GeneralRe: *char problem Pin
PJ Arends13-Aug-05 10:04
professionalPJ Arends13-Aug-05 10:04 
GeneralRe: *char problem Pin
Axonn Echysttas13-Aug-05 10:51
Axonn Echysttas13-Aug-05 10:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.