Click here to Skip to main content
16,013,082 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: PlaySound (MFC) Pin
Mark Salsbery29-Apr-07 8:13
Mark Salsbery29-Apr-07 8:13 
QuestionRegistering a PKCS#12 file Pin
Andy H29-Apr-07 0:23
Andy H29-Apr-07 0:23 
AnswerRe: Registering a PKCS#12 file Pin
cmk29-Apr-07 0:50
cmk29-Apr-07 0:50 
Questionnavigate a dialog using up and down arrows and not tab... Pin
Joan M29-Apr-07 0:19
professionalJoan M29-Apr-07 0:19 
AnswerRe: navigate a dialog using up and down arrows and not tab... Pin
GuyM29-Apr-07 1:03
GuyM29-Apr-07 1:03 
GeneralRe: navigate a dialog using up and down arrows and not tab... Pin
Joan M29-Apr-07 1:06
professionalJoan M29-Apr-07 1:06 
QuestionHow to change the background color of a button? Pin
eli1502197928-Apr-07 23:56
eli1502197928-Apr-07 23:56 
QuestionRe: How to change the background color of a button? [modified] Pin
Doc Lobster29-Apr-07 0:20
Doc Lobster29-Apr-07 0:20 
Hi,

looks to me like an allocation issue. You are casting your local CBrush object into a brush handle - which one will become invalid at the end of the method, since the CBrush destructor will be called.

Using

<br />
hbr = CreateSolidBrush(RGB(0,0,0));


instead of

 brush.CreateSolidBrush(RGB(0,0,0));<br />
hbr = brush;


should solve this problem.

However, I just looked into the MSDN Lib example to CWnd::OnCtlColor(...) and their Brush was defined in the header of the class, so the OnCtlColor caller most probably will not delete the Brush after using it. So using GDI's CreateSolidBrush(...) directly will cause a memory leak? It's probably best you do it exactly as in their example ... . I'm now Confused | :confused: , this should be such an easy thing ...

Andreas


-- modified at 6:27 Sunday 29th April, 2007
AnswerRe: How to change the background color of a button? Pin
eli1502197929-Apr-07 1:08
eli1502197929-Apr-07 1:08 
AnswerRe: How to change the background color of a button? Pin
Joan M29-Apr-07 1:04
professionalJoan M29-Apr-07 1:04 
GeneralRe: How to change the background color of a button? Pin
eli1502197929-Apr-07 1:16
eli1502197929-Apr-07 1:16 
GeneralRe: How to change the background color of a button? Pin
Joan M29-Apr-07 1:24
professionalJoan M29-Apr-07 1:24 
AnswerRe: How to change the background color of a button? Pin
Michael Dunn29-Apr-07 21:00
sitebuilderMichael Dunn29-Apr-07 21:00 
QuestionHow to Understand the macro ON_ONCTROL_RANGE Pin
cnhnyu28-Apr-07 23:53
cnhnyu28-Apr-07 23:53 
AnswerRe: How to Understand the macro ON_ONCTROL_RANGE Pin
Michael Dunn29-Apr-07 21:03
sitebuilderMichael Dunn29-Apr-07 21:03 
GeneralRe: How to Understand the macro ON_ONCTROL_RANGE Pin
cnhnyu1-May-07 18:23
cnhnyu1-May-07 18:23 
QuestionA difficult decision, C programming Pin
C_Zealot28-Apr-07 22:58
C_Zealot28-Apr-07 22:58 
AnswerRe: A difficult decision, C programming Pin
Arun.Immanuel28-Apr-07 23:45
Arun.Immanuel28-Apr-07 23:45 
GeneralRe: A difficult decision, C programming Pin
C_Zealot28-Apr-07 23:52
C_Zealot28-Apr-07 23:52 
GeneralRe: A difficult decision, C programming Pin
Arun.Immanuel29-Apr-07 0:05
Arun.Immanuel29-Apr-07 0:05 
GeneralRe: A difficult decision, C programming Pin
C_Zealot29-Apr-07 0:08
C_Zealot29-Apr-07 0:08 
QuestionAbout Audio-network program Pin
kcynic28-Apr-07 22:35
kcynic28-Apr-07 22:35 
AnswerRe: About Audio-network program Pin
Mark Salsbery29-Apr-07 8:21
Mark Salsbery29-Apr-07 8:21 
GeneralRe: About Audio-network program Pin
kcynic29-Apr-07 16:37
kcynic29-Apr-07 16:37 
GeneralRe: About Audio-network program Pin
Mark Salsbery30-Apr-07 6:41
Mark Salsbery30-Apr-07 6:41 

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.