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

C / C++ / MFC

 
Questionsending url POST method Pin
hamavreg2-Oct-05 6:55
hamavreg2-Oct-05 6:55 
AnswerRe: sending url POST method Pin
Ravi Bhavnani2-Oct-05 7:58
professionalRavi Bhavnani2-Oct-05 7:58 
AnswerRe: sending url POST method Pin
ThatsAlok2-Oct-05 18:19
ThatsAlok2-Oct-05 18:19 
Questiondeclaring const strings Pin
Chintoo7232-Oct-05 6:28
Chintoo7232-Oct-05 6:28 
AnswerRe: declaring const strings Pin
LighthouseJ2-Oct-05 7:28
LighthouseJ2-Oct-05 7:28 
AnswerRe: declaring const strings Pin
Rage_bla2-Oct-05 7:40
Rage_bla2-Oct-05 7:40 
AnswerRe: declaring const strings Pin
Rick York2-Oct-05 11:18
mveRick York2-Oct-05 11:18 
QuestionSimple GDI Problem Pin
LighthouseJ2-Oct-05 5:39
LighthouseJ2-Oct-05 5:39 
I have an SDI application, and I'm operating in the OnPaint handler for WM_PAINT messages in my CChildView derived from CWnd. In the CChildView class, I have 2 pointers to class objects I made derived from CObList which are initialized to NULL when the view is constructed. When I open the file, data is read in and one or both lists may be filled with items. Here is some example code:

void CChildView::OnPaint() {<br />
  CPaintDC dc(this); // device context for paintingif (files != NULL) {<br />
  if (files != NULL {<br />
    char * lpszText = new char[32];<br />
    sprintf (lpszText, "Files: %u", files->GetCount());<br />
    int nTextHeight = dc.DrawText(lpszText, -1, CRect(10, 30, 100, 100), DT_LEFT | DT_SINGLELINE);<br />
    MessageBox(_T("files detected"), NULL, MB_OK);<br />
    delete[] lpszText;<br />
  } else { dc.DrawText(_T("Files: 0"), CRect(10, 30, 100, 100), DT_LEFT); }<br />
}


Now, what happens is when I start the app, I am told there are no files which is right. When I open the file, the code runs through and I see the MessageBox displayed but the text that should have been drawn in the line above it doesn't show up on the screen. However, if I were to put a breakpoint on the sprintf line, start the program, load a file, it would break on the line and I were to press F5 to continue executing, the result of DrawText would show up on the screen fine and the message box would pop up too.

I've tried to see if I'm doing something wrong or if I'm not doing something I should here and on other GDI tutorial sites but I can't figure out why this behavior exists. Can someone please set me straight?
GeneralRe: Simple GDI Problem Pin
Anton Mikhalyov2-Oct-05 7:55
Anton Mikhalyov2-Oct-05 7:55 
GeneralRe: Simple GDI Problem Pin
LighthouseJ2-Oct-05 15:55
LighthouseJ2-Oct-05 15:55 
AnswerRe: Simple GDI Problem Pin
Jose Lamas Rios2-Oct-05 9:30
Jose Lamas Rios2-Oct-05 9:30 
GeneralRe: Simple GDI Problem Pin
LighthouseJ2-Oct-05 15:57
LighthouseJ2-Oct-05 15:57 
QuestionNotifaction Area Pin
G Cross2-Oct-05 5:26
G Cross2-Oct-05 5:26 
AnswerRe: Notifaction Area Pin
ThatsAlok2-Oct-05 18:24
ThatsAlok2-Oct-05 18:24 
Questionconfused Pin
benjnp2-Oct-05 5:12
benjnp2-Oct-05 5:12 
QuestionWhich database access tech to use? Pin
Shao Voon Wong2-Oct-05 3:12
mvaShao Voon Wong2-Oct-05 3:12 
AnswerRe: Which database access tech to use? Pin
Ghasrfakhri2-Oct-05 3:22
Ghasrfakhri2-Oct-05 3:22 
GeneralRe: Which database access tech to use? Pin
Shao Voon Wong2-Oct-05 3:37
mvaShao Voon Wong2-Oct-05 3:37 
GeneralRe: Which database access tech to use? Pin
Ghasrfakhri2-Oct-05 10:53
Ghasrfakhri2-Oct-05 10:53 
GeneralRe: Which database access tech to use? Pin
Shao Voon Wong2-Oct-05 18:12
mvaShao Voon Wong2-Oct-05 18:12 
GeneralRe: Which database access tech to use? Pin
David Crow3-Oct-05 3:01
David Crow3-Oct-05 3:01 
AnswerRe: Which database access tech to use? Pin
toxcct2-Oct-05 3:58
toxcct2-Oct-05 3:58 
GeneralRe: Which database access tech to use? Pin
Shao Voon Wong2-Oct-05 18:16
mvaShao Voon Wong2-Oct-05 18:16 
GeneralRe: Which database access tech to use? Pin
toxcct2-Oct-05 21:11
toxcct2-Oct-05 21:11 
AnswerRe: Which database access tech to use? Pin
John M. Drescher2-Oct-05 6:27
John M. Drescher2-Oct-05 6:27 

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.