Click here to Skip to main content
15,895,667 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Case Sensitive Pin
Chatura Dilan25-Jul-06 22:13
Chatura Dilan25-Jul-06 22:13 
QuestionRe: Case Sensitive Pin
David Crow27-Jul-06 2:46
David Crow27-Jul-06 2:46 
QuestionImplementing a custom Dialogbox Pin
Kamal Shankar25-Jul-06 15:59
Kamal Shankar25-Jul-06 15:59 
AnswerRe: Implementing a custom Dialogbox Pin
spacecadet1025-Jul-06 16:25
spacecadet1025-Jul-06 16:25 
QuestionNeed help with ported c++ triangulation routine [modified] Pin
spacecadet1025-Jul-06 15:02
spacecadet1025-Jul-06 15:02 
AnswerRe: Need help with ported c++ triangulation routine Pin
Steve Echols25-Jul-06 20:35
Steve Echols25-Jul-06 20:35 
GeneralRe: Need help with ported c++ triangulation routine Pin
spacecadet1029-Jul-06 16:54
spacecadet1029-Jul-06 16:54 
Questionmfc drawing philosophy question - when is the correct time to draw? Pin
charlieg25-Jul-06 14:10
charlieg25-Jul-06 14:10 
I have some drawing code that seems to work *most of the time*. Trying to use some of this code today, I've encountered all sorts of odd behavior, and I'm questioning how I originally implemented this code. What I need from people who are deeper into Windows than I is the "why" of how painting/drawing in Windows actually works.

My app is dialog based. Some of the dialogs have to update graphics as fast as reasonably possible. So, early in my Windows development curve, I crafted my solution like so:

myclassdlg::OnInitDlg()
{
// set everything up...
// start a timer...

SetTimer (999, 500, NULL); // every 500ms
}

myclassdlg::OnTimer()
{
// do all of my drawing.
}

Now, based on various bits and pieces I've pulled together, this is just the wrong way to go about it. Unfortunately, it worked the first time, for whatever reason, and I've continued on my perilous ways. Well, now I've run into a problem, my new drawing code (based on the above style) doesn't work, so in my research, it appears that the correct way to do things is to start the timer but in the OnTimer loop, add an UpdateWindow() call to trigger the WM_PAINT message. The OnPaint handler than executes whatever drawing is necessary.

First question: do I have this right?

Second question: assuming I have this correct, what does the "draw in the OnPaint handler" apprach imply? It would seem that "this is the way you do it", but why? Does Windows do something special such that the graphics are guaranteed to draw?

Still getting my arms around this beast called Windows.

Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.

My son's PDA is an M249 SAW.

AnswerRe: mfc drawing philosophy question - when is the correct time to draw? Pin
User 58385225-Jul-06 15:09
User 58385225-Jul-06 15:09 
AnswerRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Michael Dunn25-Jul-06 16:10
sitebuilderMichael Dunn25-Jul-06 16:10 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg25-Jul-06 16:45
charlieg25-Jul-06 16:45 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay25-Jul-06 20:43
Justin Tay25-Jul-06 20:43 
AnswerRe: mfc drawing philosophy question - when is the correct time to draw? [modified] Pin
charlieg26-Jul-06 1:13
charlieg26-Jul-06 1:13 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay26-Jul-06 2:22
Justin Tay26-Jul-06 2:22 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg26-Jul-06 3:39
charlieg26-Jul-06 3:39 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg26-Jul-06 4:02
charlieg26-Jul-06 4:02 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay26-Jul-06 4:19
Justin Tay26-Jul-06 4:19 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg26-Jul-06 4:24
charlieg26-Jul-06 4:24 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay26-Jul-06 4:13
Justin Tay26-Jul-06 4:13 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg26-Jul-06 4:59
charlieg26-Jul-06 4:59 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay26-Jul-06 5:34
Justin Tay26-Jul-06 5:34 
QuestionConvert CString to Unsigned short & Vice Versa Pin
JBAK_CP25-Jul-06 13:00
JBAK_CP25-Jul-06 13:00 
AnswerRe: Convert CString to Unsigned short &Vice Versa Pin
Justin Tay25-Jul-06 13:15
Justin Tay25-Jul-06 13:15 
QuestionBitmap associated with a static control Pin
cphawk25-Jul-06 12:09
cphawk25-Jul-06 12:09 
AnswerRe: Bitmap associated with a static control Pin
sudeesh26-Jul-06 2:40
sudeesh26-Jul-06 2:40 

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.