L
linganmm
Guest
Hi, I am developing a CViewTree in which the text of items is editable in my SDI program.
In CViewTree::OnTvnBeginlabeledit(...), I write:
pEdit = GetEditControl();
pEdit->LimitText(20);
While in CViewTree::OnTvnEndlabeledit(...), I write
CString newName;
pEdit->GetWindowTextW(newName);
to retrieve the new value of the text.
Then I find a weird problem. As the following picture shows:
If I finish the editing by mouse clicking the area in the green box, then everything is ok. But if I finish the editing by mouse clicking the area in the red box, say, the client area, the program crashes:
Step by Step trace shows it crashes at pEdit->GetWindowTextW(newName); and pEdit is not null.
Any idea about this? How to prevent the crash?
My IDE is VS2015.
Thank you very much for any clues!
Continue reading...
In CViewTree::OnTvnBeginlabeledit(...), I write:
pEdit = GetEditControl();
pEdit->LimitText(20);
While in CViewTree::OnTvnEndlabeledit(...), I write
CString newName;
pEdit->GetWindowTextW(newName);
to retrieve the new value of the text.
Then I find a weird problem. As the following picture shows:
If I finish the editing by mouse clicking the area in the green box, then everything is ok. But if I finish the editing by mouse clicking the area in the red box, say, the client area, the program crashes:
Step by Step trace shows it crashes at pEdit->GetWindowTextW(newName); and pEdit is not null.
Any idea about this? How to prevent the crash?
My IDE is VS2015.
Thank you very much for any clues!
Continue reading...