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

C / C++ / MFC

 
GeneralReading Writing XML in C++ 6.0 Pin
Gilfrog19-Sep-02 18:34
Gilfrog19-Sep-02 18:34 
GeneralRe: Reading Writing XML in C++ 6.0 Pin
Jason Henderson19-Sep-02 19:06
Jason Henderson19-Sep-02 19:06 
GeneralRe: Reading Writing XML in C++ 6.0 Pin
Paul M Watt19-Sep-02 19:27
mentorPaul M Watt19-Sep-02 19:27 
GeneralRe: Reading Writing XML in C++ 6.0 Pin
Steve S19-Sep-02 21:53
Steve S19-Sep-02 21:53 
Generalpostmessage Pin
Anonymous19-Sep-02 18:33
Anonymous19-Sep-02 18:33 
GeneralRe: postmessage Pin
Jason Henderson19-Sep-02 19:11
Jason Henderson19-Sep-02 19:11 
GeneralRe: postmessage Pin
Steve S20-Sep-02 0:27
Steve S20-Sep-02 0:27 
GeneralGetting the server name Pin
Shibu19-Sep-02 17:49
Shibu19-Sep-02 17:49 
GeneralRe: Getting the server name Pin
Mazdak19-Sep-02 20:36
Mazdak19-Sep-02 20:36 
GeneralRe: Getting the server name Pin
Mike Nordell20-Sep-02 4:58
Mike Nordell20-Sep-02 4:58 
GeneralEvaluation program Pin
Stew19-Sep-02 17:26
Stew19-Sep-02 17:26 
GeneralRe: Evaluation program Pin
Christian Graus19-Sep-02 17:33
protectorChristian Graus19-Sep-02 17:33 
GeneralRe: Evaluation program Pin
Rohit  Sinha19-Sep-02 21:50
Rohit  Sinha19-Sep-02 21:50 
GeneralRe: Evaluation program Pin
Christian Graus19-Sep-02 21:56
protectorChristian Graus19-Sep-02 21:56 
GeneralRe: Evaluation program Pin
Chris Losinger19-Sep-02 17:34
professionalChris Losinger19-Sep-02 17:34 
GeneralRe: Evaluation program Pin
Nish Nishant19-Sep-02 18:34
sitebuilderNish Nishant19-Sep-02 18:34 
GeneralA question about pointer of function. Pin
George Ma19-Sep-02 17:16
George Ma19-Sep-02 17:16 
GeneralRe: A question about pointer of function. Pin
Chris Losinger19-Sep-02 17:22
professionalChris Losinger19-Sep-02 17:22 
GeneralRe: A question about pointer of function. Pin
George Ma20-Sep-02 2:29
George Ma20-Sep-02 2:29 
Questionhelp dl issu? Pin
imran_rafique19-Sep-02 16:35
imran_rafique19-Sep-02 16:35 
AnswerRe: help dl issu? Pin
Chris Losinger19-Sep-02 17:28
professionalChris Losinger19-Sep-02 17:28 
Questionhow to?( DLL) Pin
imran_rafique19-Sep-02 15:52
imran_rafique19-Sep-02 15:52 
AnswerRe: how to?( DLL) Pin
Paul M Watt19-Sep-02 19:04
mentorPaul M Watt19-Sep-02 19:04 
QuestionCEditView -> CEdit::ReplaceSel() leaks GDI Objects? Pin
scott sanders19-Sep-02 15:03
scott sanders19-Sep-02 15:03 
I have an MDI app using CEditView in the Doc/View architecture. In this view, I have a function like so, which I call from the Document class:

void CMyEditView::addText(LPCTSTR szOutput)
{
ASSERT_VALID(this);
int nSize = GetBufferLength();
GetEditCtrl().SetSel(nSize, nSize, TRUE);
GetEditCtrl().ReplaceSel(szOutput, FALSE);
}

After feeding it data for a while, the program inevitably crashes and the display gets corrupted. By watching the executable's resources in Task Manager, I notice that the GDI Objects are steadily increasing, until they reach 9999, and then the crash happens. By setting breakpoints, I can see that one GDI Object is consumed every time CEdit::ReplaceSel() is called, and never released.

Is this method for appending text to an Edit Control contained in a View appropriate? Anyone know a better way? Using GetWindowText() and SetWindowText() has the same problem! Any thoughts as to what's happening, and how I can prevent the resource loss?

Thanks !

scott sanders


AnswerRe: CEditView -> CEdit::ReplaceSel() leaks GDI Objects? Pin
Hans Ruck19-Sep-02 21:41
Hans Ruck19-Sep-02 21: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.