Click here to Skip to main content
15,877,547 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionConverting hexadecimal code into RGB Pin
Dhiraj kumar Saini6-Nov-08 22:13
Dhiraj kumar Saini6-Nov-08 22:13 
AnswerRe: Converting hexadecimal code into RGB Pin
CPallini6-Nov-08 22:36
mveCPallini6-Nov-08 22:36 
GeneralRe: Converting hexadecimal code into RGB Pin
Dhiraj kumar Saini6-Nov-08 22:49
Dhiraj kumar Saini6-Nov-08 22:49 
GeneralRe: Converting hexadecimal code into RGB Pin
CPallini6-Nov-08 22:52
mveCPallini6-Nov-08 22:52 
GeneralRe: Converting hexadecimal code into RGB Pin
Dhiraj kumar Saini6-Nov-08 23:34
Dhiraj kumar Saini6-Nov-08 23:34 
QuestionRe: Converting hexadecimal code into RGB Pin
David Crow7-Nov-08 2:45
David Crow7-Nov-08 2:45 
AnswerRe: Converting hexadecimal code into RGB Pin
CPallini7-Nov-08 3:31
mveCPallini7-Nov-08 3:31 
AnswerRe: Converting hexadecimal code into RGB Pin
sashoalm8-Nov-08 0:07
sashoalm8-Nov-08 0:07 
See the definition of RGB:
#define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))

What RGB does is it gives you a hexadecimal number.
COLORREF cr = 0x000000ff;
COLORREF cr = RGB(255, 0, 0);
are equivalent.

You can replace
int num = _tcstol(input + 1, &pStop, 16);
b1 = (num & 0xFF0000) >> 16;
b2 = (num & 0xFF00) >> 8;
b3 = num & 0xFF;
COLORREF crBkgnd = RGB(b1 ,b2 ,b3 );

with
COLORREF crBkgnd = _tcstol(input + 1, &pStop, 16);


There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal

QuestionDraw on view and over their controls [modified] Pin
baerten6-Nov-08 21:53
baerten6-Nov-08 21:53 
AnswerRe: Draw on view and over their controls Pin
Nishad S7-Nov-08 1:48
Nishad S7-Nov-08 1:48 
GeneralRe: Draw on view and over their controls Pin
baerten7-Nov-08 4:20
baerten7-Nov-08 4:20 
GeneralRe: Draw on view and over their controls Pin
Nishad S7-Nov-08 23:02
Nishad S7-Nov-08 23:02 
GeneralRe: Draw on view and over their controls Pin
baerten9-Nov-08 20:53
baerten9-Nov-08 20:53 
QuestionCan i open & access view of another window in a MFC SDI application Pin
m_mun6-Nov-08 19:37
m_mun6-Nov-08 19:37 
AnswerRe: Can i open & access view of another window in a MFC SDI application Pin
Nishad S7-Nov-08 1:50
Nishad S7-Nov-08 1:50 
QuestionRegarding application expiration Pin
H4u326-Nov-08 19:22
H4u326-Nov-08 19:22 
AnswerRe: Regarding application expiration Pin
Saurabh.Garg6-Nov-08 19:56
Saurabh.Garg6-Nov-08 19:56 
GeneralRe: Regarding application expiration Pin
H4u326-Nov-08 20:11
H4u326-Nov-08 20:11 
GeneralRe: Regarding application expiration Pin
Saurabh.Garg6-Nov-08 20:17
Saurabh.Garg6-Nov-08 20:17 
GeneralRe: Regarding application expiration Pin
H4u326-Nov-08 20:21
H4u326-Nov-08 20:21 
GeneralRe: Regarding application expiration Pin
Saurabh.Garg6-Nov-08 20:28
Saurabh.Garg6-Nov-08 20:28 
GeneralRe: Regarding application expiration Pin
H4u326-Nov-08 20:33
H4u326-Nov-08 20:33 
GeneralRe: Regarding application expiration Pin
Saurabh.Garg6-Nov-08 20:48
Saurabh.Garg6-Nov-08 20:48 
GeneralRe: Regarding application expiration Pin
David Crow7-Nov-08 2:50
David Crow7-Nov-08 2:50 
AnswerRe: Regarding application expiration Pin
beko6-Nov-08 20:45
beko6-Nov-08 20:45 

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.