高手进来 看看这段代码哪里错了(10分)

J

jiajv_

Unregistered / Unconfirmed
GUEST, unregistred user!
void CPostmessageView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
CPostmessageDoc * pdoc;//声明指针
pdoc=GetDocument();
pdoc->mystring=nChar;//我测试是这一句出的错
CClientDC mydc(this);//声明设备上下文
mydc.TextOut(0,0,pdoc->mystring);
pdoc->mystring.GetLength();//??
pdoc->UpdateAllViews(this,0L,0);
CView::OnChar(nChar, nRepCnt, nFlags);
编译时出内存错误 说××内存不能为read
 
mystring maybe a CString class.
in this class, CString(UINT nChar) constructor didn't implement.
 
pdoc->mystring=nChar
修改为
pdoc->mystring.Format("%d",nChar);
应该就可以了。
 
顶部