CListCtrl控件
我在做CListCtrl控件时,引用了别人做的类,在vc6.0运行是正确的,我自己导入到vc.net2003就出现了问题:
“类型转换” : 无法从“int”转换为“ATL::CStringT<BaseType,StringTraits>”
with [
BaseType=char,
StringTraits=StrTraitMFC_DLL<char>
]
无构造函数可以接受源类型,或构造函数重载决策不明确。
错误指向amsEdit.cpp中的函数:
void CAMSEdit::MaskedBehavior::_OnChar(UINT uChar, UINT nRepCnt, UINT nFlags)
{
TCHAR c = (TCHAR)uChar;
// If the mask is empty, allow anything
int nMaskLen = m_strMask.GetLength();
if (!nMaskLen) //如果MASK是空则全通
{
if (_ShouldEnter(c))
Behavior::_OnChar(uChar, nRepCnt, nFlags);
return;
}
// Check that we haven't gone past the mask's length
int nStart, nEnd;
int iRet;
TCHAR cMask;
m_pEdit->GetSel(nStart, nEnd);
CString strText = m_pEdit->GetText();
int nLen = strText.GetLength();
if (!_istprint(c)) //控制符
{
if (c == VK_BACK && !IsEnd(nStart, strText))
{//不是末尾,则只移动
m_pEdit->SendMessage(WM_KEYDOWN, VK_LEFT); // move the cursor left
return;
}
if(c == VK_BACK)
{//移到下一个有效位
if (nStart==0) return ; //首位
iRet = MovePrevious(0, nStart);
if(iRet < 0)
{//移到首位
m_pEdit->SetSel(0, 0);
return ;
}
else if(iRet != nStart-1)
{//前位是掩码
m_pEdit->SendMessage(WM_KEYDOWN, VK_LEFT);
return;
}
m_pEdit->SetSel(iRet, iRet+1); //有效位后面
m_pEdit->ReplaceSel(CString(VK_SPACE), TRUE); ********错误指向这里**********
m_pEdit->SetSel(iRet, iRet); //有效位后面
return;
}
// Allow backspace only if the cursor is all the way to the right
if (_ShouldEnter(c)) //执行
Behavior::_OnChar(uChar, nRepCnt, nFlags);
return;
}