error C2664: 'strcpy' : cannot convert parameter 2 from 'CString' to 'const char *'
voidCClipboardDlg::OnBnClickedBtnSend(){//TODO:Addyourcontrolnotificationhandlercodeh...
void CClipboardDlg::OnBnClickedBtnSend()
{
// TODO: Add your control notification handler code here
if(OpenClipboard())
{
CString str;
HANDLE hClip;
char *pBuf;
EmptyClipboard();
GetDlgItemText(IDC_EDIT_SEND,str);
hClip=GlobalAlloc(GMEM_MOVEABLE,str.GetLength()+1);
pBuf=(char*)GlobalLock(hClip);
strcpy(pBuf,str);
GlobalUnlock(hClip);
SetClipboardData(CF_TEXT,hClip);
CloseClipboard();
}
}
这是在vs 2005下的错误,在vc 6里面是对的,能帮我改一下吗,我就是要用unicode,但是改成了wchar后运行起来就不对了 展开
{
// TODO: Add your control notification handler code here
if(OpenClipboard())
{
CString str;
HANDLE hClip;
char *pBuf;
EmptyClipboard();
GetDlgItemText(IDC_EDIT_SEND,str);
hClip=GlobalAlloc(GMEM_MOVEABLE,str.GetLength()+1);
pBuf=(char*)GlobalLock(hClip);
strcpy(pBuf,str);
GlobalUnlock(hClip);
SetClipboardData(CF_TEXT,hClip);
CloseClipboard();
}
}
这是在vs 2005下的错误,在vc 6里面是对的,能帮我改一下吗,我就是要用unicode,但是改成了wchar后运行起来就不对了 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询