Click here to Skip to main content
15,905,614 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
Questionmechanism for the a dll to send back periodic info? Pin
ns19-Sep-02 12:02
ns19-Sep-02 12:02 
AnswerRe: mechanism for the a dll to send back periodic info? Pin
Chris Losinger19-Sep-02 12:55
professionalChris Losinger19-Sep-02 12:55 
GeneralRe: mechanism for the a dll to send back periodic info? Pin
ns20-Sep-02 1:32
ns20-Sep-02 1:32 
AnswerRe: mechanism for the a dll to send back periodic info? Pin
Paul M Watt19-Sep-02 19:31
mentorPaul M Watt19-Sep-02 19:31 
GeneralGUI with Visual C Pin
E. Bonizzoni19-Sep-02 12:03
E. Bonizzoni19-Sep-02 12:03 
GeneralRe: GUI with Visual C Pin
Christian Graus19-Sep-02 13:11
protectorChristian Graus19-Sep-02 13:11 
GeneralRe: GUI with Visual C Pin
Paul M Watt19-Sep-02 19:39
mentorPaul M Watt19-Sep-02 19:39 
GeneralChanging the mask color for the IDR_MAINFRAME icon Pin
monrobot1319-Sep-02 11:14
monrobot1319-Sep-02 11:14 
GeneralRe: Changing the mask color for the IDR_MAINFRAME icon Pin
Shog919-Sep-02 14:24
sitebuilderShog919-Sep-02 14:24 
GeneralProgressbar question Pin
ns19-Sep-02 11:09
ns19-Sep-02 11:09 
GeneralRe: Progressbar question Pin
Carlos Antollini19-Sep-02 11:13
Carlos Antollini19-Sep-02 11:13 

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.