السلام عليكم ورحمة الله
bool CVerifyMACFormatDlg::VerifyMacAddress(CString Mac)
{ bool bRet = false;
Mac.MakeUpper().Remove(_T(' '));
if(Mac.GetLength() == 12)
{
for(int i=0; i<12; i++)
{ if( !( ( (Mac >= _T('0')) && (Mac <= _T('9')) ) || ( (Mac >= _T('A')) && (Mac <= _T('F')) ) ) )
{break;}
if(i==11) bRet = true;
}
}
return bRet;
}// Check the correctness of the given MAC address format
void CVerifyMACFormatDlg::OnBnClickedOk()
{ CString strMac;
m_MACtxt.GetWindowText(strMac);
if(!VerifyMacAddress(strMac))
AfxMessageBox(_T(".صياغة خاطئة للعنوان, رجاء المراجعة"),MB_OK|MB_ICONHAND);
else AfxMessageBox(_T(".صياغة صحيحة للعنوان"),MB_OK|MB_ICONINFORMATION);
}// show the about window
void CVerifyMACFormatDlg::OnBnClickedButton1()
{ CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
