代码如下:
void CCharView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
// TODO: Add your message handler code here and/or call default
    strChar+=nChar;
Invalidate();

CView::OnChar(nChar, nRepCnt, nFlags);
}
void CCharView::OnDraw(CDC* pDC)
{
CCharDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->TextOut (100,200,strChar);
}
可以实现对输入文本的现实,但后面不能显示光标,不知怎样解决 请高手指教

解决方案 »

  1.   

    CreateCaret(hwnd, (HBITMAP) NULL, nWidth, nHeight); 
    SetCaretPos(x, y); 
    ShowCaret(hwnd); 具体使用查查MSDN就行了。
      

  2.   

    CView 类无插入符从CEditView类派生
      

  3.   

    gomi(阿高) 大哥:
    CreateCaret(hwnd, (HBITMAP) NULL, nWidth, nHeight); 
    SetCaretPos(x, y); 
    这两个函数有语法错误 提示只需一个参数 是CWnd::CreateCaret( CBitmap* pBitmap ); 
    但是如果代码如下的话
    CreateCaret(  NULL); 
    CPoint p1;p1.x=106+strChar.GetLength()*8;p1.y=200;
    SetCaretPos(p1); 
    ShowCaret(); 
    只显示一个显示的点 而不是一个竖直线
    请各位大哥不吝赐教
      

  4.   

    你调用CWnd的CreateCaret,参数不能为NULL,需要给出一个CBitmap对象