B
Bo_soft
Unregistered / Unconfirmed
GUEST, unregistred user!
void CCEHatDirFacTimSysDlg::OnKillfocusStnId()
{
//获取站点编号
int iTemp, i;
char cTemp;
CString sTemp;
GetDlgItem(IDC_STN_ID)->GetWindowText(sTemp);
iTemp = sTemp.GetLength();
if(iTemp < 8) sTemp = "00000000"
+ sTemp;
sTemp = sTemp.Right(8);
sTemp.MakeUpper();//将小写转换成大写
m_FacNumber = 0;
//DWORD类型
for(i = 0;
i < 8;
i++)
{
cTemp = sTemp.GetAt(i);
if((cTemp >= 0x30) &&
(cTemp <= 0x39))
{
m_FacNumber = m_FacNumber * 0x10 + (cTemp - 0x30);
}
else
if((cTemp >= 0x41) &&
(cTemp <= 0x46))
{
m_FacNumber = m_FacNumber * 0x10 + (cTemp - 0x37);
}
}
GetDlgItem(IDC_STN_ID)->SetWindowText(sTemp);
}
上面是在VC中实现的(将字符串转换成DWORD类型16进制表示),在Delphi中怎么样实现与其上面相同的功能,还请大家指教!
{
//获取站点编号
int iTemp, i;
char cTemp;
CString sTemp;
GetDlgItem(IDC_STN_ID)->GetWindowText(sTemp);
iTemp = sTemp.GetLength();
if(iTemp < 8) sTemp = "00000000"
+ sTemp;
sTemp = sTemp.Right(8);
sTemp.MakeUpper();//将小写转换成大写
m_FacNumber = 0;
//DWORD类型
for(i = 0;
i < 8;
i++)
{
cTemp = sTemp.GetAt(i);
if((cTemp >= 0x30) &&
(cTemp <= 0x39))
{
m_FacNumber = m_FacNumber * 0x10 + (cTemp - 0x30);
}
else
if((cTemp >= 0x41) &&
(cTemp <= 0x46))
{
m_FacNumber = m_FacNumber * 0x10 + (cTemp - 0x37);
}
}
GetDlgItem(IDC_STN_ID)->SetWindowText(sTemp);
}
上面是在VC中实现的(将字符串转换成DWORD类型16进制表示),在Delphi中怎么样实现与其上面相同的功能,还请大家指教!