Click here to Skip to main content
15,893,814 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: processing ESC key Pin
Christian Graus18-Oct-05 14:23
protectorChristian Graus18-Oct-05 14:23 
QuestionRe: processing ESC key Pin
David Crow19-Oct-05 3:40
David Crow19-Oct-05 3:40 
QuestionCPaintDC resource Pin
LighthouseJ18-Oct-05 13:30
LighthouseJ18-Oct-05 13:30 
AnswerRe: CPaintDC resource Pin
Christian Graus18-Oct-05 13:36
protectorChristian Graus18-Oct-05 13:36 
GeneralRe: CPaintDC resource Pin
LighthouseJ18-Oct-05 13:53
LighthouseJ18-Oct-05 13:53 
GeneralRe: CPaintDC resource Pin
Christian Graus18-Oct-05 13:57
protectorChristian Graus18-Oct-05 13:57 
GeneralRe: CPaintDC resource Pin
LighthouseJ18-Oct-05 14:22
LighthouseJ18-Oct-05 14:22 
GeneralRe: CPaintDC resource Pin
Christian Graus18-Oct-05 14:29
protectorChristian Graus18-Oct-05 14:29 
LighthouseJ wrote:
I actually did that originally but I got the aforementioned error because I was trying to free memory from another threads heap.


Well, it's the way it needs to be done, you need to work out those threading issues, I guess..


LighthouseJ wrote:
CBrush * grey = new CBrush (RGB(192, 192, 192));
CBrush * black = new CBrush (RGB(255, 255, 255));
dc.SelectObject (grey);

< drawing done here >

dc.SelectObject(black);

delete grey;
delete black;


This is wrong.


CBrush * grey = new CBrush (RGB(192, 192, 192));
CBrush * black = dc.SelectObject (grey);

< drawing done here >

dc.SelectObject(black);

delete grey;

You need to grab the brush that SelectObject returns, and put it back when you're done.

Christian Graus - Microsoft MVP - C++
GeneralRe: CPaintDC resource Pin
LighthouseJ18-Oct-05 14:34
LighthouseJ18-Oct-05 14:34 
GeneralRe: CPaintDC resource Pin
Christian Graus18-Oct-05 15:02
protectorChristian Graus18-Oct-05 15:02 
GeneralRe: CPaintDC resource Pin
PJ Arends18-Oct-05 15:44
professionalPJ Arends18-Oct-05 15:44 
GeneralRe: CPaintDC resource Pin
LighthouseJ18-Oct-05 15:51
LighthouseJ18-Oct-05 15:51 
Questionhow to insert byte array to sql? Pin
GoodQuestion18-Oct-05 12:10
GoodQuestion18-Oct-05 12:10 
QuestionVisual C++ Heap error Pin
Tam98765432118-Oct-05 11:32
Tam98765432118-Oct-05 11:32 
QuestionRe: Visual C++ Heap error Pin
David Crow19-Oct-05 3:43
David Crow19-Oct-05 3:43 
AnswerRe: Visual C++ Heap error Pin
Tam98765432119-Oct-05 8:38
Tam98765432119-Oct-05 8:38 
QuestionBool data type issue Pin
Anonymous18-Oct-05 10:17
Anonymous18-Oct-05 10:17 
AnswerRe: Bool data type issue Pin
Dezhi Zhao18-Oct-05 10:52
Dezhi Zhao18-Oct-05 10:52 
AnswerRe: Bool data type issue Pin
John M. Drescher18-Oct-05 11:11
John M. Drescher18-Oct-05 11:11 
GeneralRe: Bool data type issue Pin
itkid18-Oct-05 11:41
itkid18-Oct-05 11:41 
Questionconfusion with memory mapped files Pin
Chintoo72318-Oct-05 7:20
Chintoo72318-Oct-05 7:20 
AnswerRe: confusion with memory mapped files Pin
Joe Woodbury18-Oct-05 7:59
professionalJoe Woodbury18-Oct-05 7:59 
QuestionMemory problems Pin
bugDanny18-Oct-05 6:55
bugDanny18-Oct-05 6:55 
AnswerRe: Memory problems Pin
PJ Arends18-Oct-05 7:04
professionalPJ Arends18-Oct-05 7:04 
AnswerRe: Memory problems Pin
David Crow18-Oct-05 7:36
David Crow18-Oct-05 7:36 

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.