Click here to Skip to main content
15,889,281 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionsocket copy Pin
Shotgun18-Oct-05 14:29
Shotgun18-Oct-05 14:29 
AnswerRe: socket copy Pin
l a u r e n18-Oct-05 17:52
l a u r e n18-Oct-05 17:52 
AnswerRe: socket copy Pin
sunit518-Oct-05 20:32
sunit518-Oct-05 20:32 
GeneralRe: socket copy Pin
vikas amin19-Oct-05 1:33
vikas amin19-Oct-05 1:33 
Questionprocessing ESC key Pin
Ann6618-Oct-05 14:06
sussAnn6618-Oct-05 14:06 
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 
I have an OnPaint function and it's being called over and over and after a while, it throws a resource exception by simply saying:
A required resource was unavailable.

I have no idea what that means beyond what it says but it's happening sometime in the OnPaint function after it's run a couple thousand times. I only get the "CPaintDC dc(this);" at the top of the try block (to catch exceptions) and then I draw or not draw with if statements later. Am I allocating the drawing context without deallocating it, do I need to release the 'dc' variable or something to the system?

Under the CPaintDC constructor, it says this as a remark:
An exception (of type CResourceException) is thrown if the Windows GetDC call fails. A device context may not be available if Windows has already allocated all of its available device contexts. Your application competes for the five common display contexts available at any given time under Windows.

Is that affecting me? If so, how I do rectify this?
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 
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 

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.