Click here to Skip to main content
15,949,686 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: CEditView -> CEdit::ReplaceSel() leaks GDI Objects? Pin
scott sanders20-Sep-02 6:59
scott sanders20-Sep-02 6:59 
GeneralRe: CEditView -> CEdit::ReplaceSel() leaks GDI Objects? Pin
Hans Ruck20-Sep-02 7:13
Hans Ruck20-Sep-02 7:13 
Generalconsole vs windows Pin
xai19-Sep-02 14:58
xai19-Sep-02 14:58 
GeneralRe: console vs windows Pin
Christian Graus19-Sep-02 15:40
protectorChristian Graus19-Sep-02 15:40 
GeneralRe: console vs windows Pin
xai21-Sep-02 5:26
xai21-Sep-02 5:26 

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.