牵着老婆满街逛

严以律己,宽以待人. 三思而后行.
GMail/GTalk: yanglinbo#google.com;
MSN/Email: tx7do#yahoo.com.cn;
QQ: 3 0 3 3 9 6 9 2 0 .

CDialogBar中编辑框控件Ctrl+c,Ctrl+V不可用的解决办法

CDialogBar中编辑框控件(Edit Control)中进行用Ctrl+C、Ctrl+V进行拷贝,粘贴操作会不可用。
其解决办法有二。

其一:
资源的Accelerator里的子项删除ID_EDIT_PASTE和ID_EDIT_COPY项就可以了,一般在IDR_MAINFRAME里。

其二:
重载PreTranslateMessage方法,其代码如下:
BOOL CToolBarDlg::PreTranslateMessage(MSG* pMsg)
{
    
if (pMsg->message >= WM_KEYFIRST && // for performance
        pMsg->message <= WM_KEYLAST)
    
{
        
// Translate dialog key if applicable
        if(::IsDialogMessage(m_hWnd, pMsg))
            
return TRUE;
    }


    
return CDialogBar::PreTranslateMessage(pMsg);
}

这样,就可以响应了。

方法一来源于:http://topic.csdn.net/t/20051117/16/4400471.html
方法二来源于:http://www.codeguru.com/cpp/w-d/dislog/ddxddv/comments.php/c1997/?thread=25622

个人认为,方法二更为妥当一些。

posted on 2008-06-02 23:34 杨粼波 阅读(585) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理