Click here to Skip to main content
15,920,896 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Answer[Message Deleted] Pin
zzgzzgok13-Mar-09 12:56
zzgzzgok13-Mar-09 12:56 
RantRe: Hight price looking for talent c/c++ guru, Pin
CPallini13-Mar-09 13:12
mveCPallini13-Mar-09 13:12 
General[Message Deleted] Pin
zzgzzgok13-Mar-09 13:14
zzgzzgok13-Mar-09 13:14 
GeneralRe: Hight price looking for talent c/c++ guru, Pin
Yusuf13-Mar-09 13:34
Yusuf13-Mar-09 13:34 
QuestionRegular expression Pin
Demian Panello13-Mar-09 12:26
Demian Panello13-Mar-09 12:26 
AnswerRe: Regular expression Pin
BobInNJ13-Mar-09 12:44
BobInNJ13-Mar-09 12:44 
GeneralRe: Regular expression Pin
Demian Panello13-Mar-09 14:19
Demian Panello13-Mar-09 14:19 
QuestionI Think I need to free Something Pin
BobInNJ13-Mar-09 11:38
BobInNJ13-Mar-09 11:38 
I am writing an application using C++ and MFC. Please consider the following routine:

<br />
HBRUSH<br />
CMainWindow::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)<br />
{<br />
	HBRUSH hbr = CFrameWnd::OnCtlColor(pDC, pWnd, nCtlColor);<br />
	if (pWnd->GetDlgCtrlID() == 2500 )   {<br />
		// Set the background mode for text to transparent<br />
		hbr = CreateSolidBrush(RGB(255, 255, 255));<br />
		pDC->SetBkColor( RGB( 255, 255, 255 ) );<br />
		// pDC->SetBkMode(TRANSPARENT);<br />
		return hbr;<br />
		<br />
	}<br />
	return hbr;<br />
}<br />


This routine is called via a message block. My belief is that ever time this routine is called, a new brush is created and it is not freed/deleted. I believe the routine should freeing/deleting the brush and I would like to know how to free/delete it.

Thanks

Bob
AnswerRe: I Think I need to free Something Pin
Stuart Dootson13-Mar-09 13:54
professionalStuart Dootson13-Mar-09 13:54 
GeneralRe: I Think I need to free Something Pin
BobInNJ14-Mar-09 13:16
BobInNJ14-Mar-09 13:16 
GeneralRe: I Think I need to free Something Pin
Stuart Dootson14-Mar-09 13:24
professionalStuart Dootson14-Mar-09 13:24 
GeneralRe: I Think I need to free Something Pin
BobInNJ14-Mar-09 14:16
BobInNJ14-Mar-09 14:16 
GeneralRe: I Think I need to free Something Pin
Stuart Dootson14-Mar-09 18:53
professionalStuart Dootson14-Mar-09 18:53 
QuestionMemory Leakege Reporting without line number Pin
Member 349347313-Mar-09 11:09
Member 349347313-Mar-09 11:09 
AnswerRe: Memory Leakege Reporting without line number Pin
Stuart Dootson13-Mar-09 13:50
professionalStuart Dootson13-Mar-09 13:50 
GeneralRe: Memory Leakege Reporting without line number Pin
Member 349347314-Mar-09 11:27
Member 349347314-Mar-09 11:27 
Questionhow do I, amend a bitmap a run time Pin
simon alec smith13-Mar-09 9:02
simon alec smith13-Mar-09 9:02 
QuestionRe: how do I, amend a bitmap a run time Pin
CPallini13-Mar-09 9:11
mveCPallini13-Mar-09 9:11 
AnswerRe: how do I, amend a bitmap a run time Pin
Hamid_RT13-Mar-09 19:48
Hamid_RT13-Mar-09 19:48 
QuestionI find an interesting and confusing code..have a look. Pin
JackPuppy13-Mar-09 8:39
JackPuppy13-Mar-09 8:39 
AnswerRe: I find an interesting and confusing code..have a look. Pin
led mike13-Mar-09 8:49
led mike13-Mar-09 8:49 
GeneralRe: I find an interesting and confusing code..have a look. Pin
JackPuppy13-Mar-09 8:55
JackPuppy13-Mar-09 8:55 
GeneralRe: I find an interesting and confusing code..have a look. Pin
David Crow13-Mar-09 8:58
David Crow13-Mar-09 8:58 
GeneralRe: I find an interesting and confusing code..have a look. Pin
JackPuppy13-Mar-09 9:03
JackPuppy13-Mar-09 9:03 
QuestionRe: I find an interesting and confusing code..have a look. Pin
David Crow13-Mar-09 9:07
David Crow13-Mar-09 9:07 

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.