}
void CTJUT_DES_TOOLDlg::OnRadioFile() {
// TODO: Add your control notification handler code here Fromwhich=FROMFILE;
myeditfile.EnableWindow(TRUE); myeditchar.EnableWindow(FALSE); myedithex.EnableWindow(FALSE); myopenfile.EnableWindow(TRUE); }
void CTJUT_DES_TOOLDlg::OnRadioHex() {
// TODO: Add your control notification handler code here Fromwhich=FROMHEX;
myeditfile.EnableWindow(FALSE); myeditchar.EnableWindow(FALSE); myedithex.EnableWindow(TRUE); myopenfile.EnableWindow(FALSE); }
void CTJUT_DES_TOOLDlg::OnCancel() {
// TODO: Add extra cleanup here
CDialog::OnCancel(); }
void CTJUT_DES_TOOLDlg::OnOK() {
// TODO: Add extra validation here
//CDialog::OnOK(); return; }
void CTJUT_DES_TOOLDlg::OnButtonCompute1() {
// TODO: Add your control notification handler code here CString oStr,oStrpwd,oStrpwdc; int iLen;
unsigned char pt[8];//=static_cast
myeditpwd.GetWindowText(oStrpwd); myeditpwdc.GetWindowText(oStrpwdc); if(oStrpwd.Compare(LPCTSTR(oStrpwdc))) { myeditresult.SetWindowText(\密钥设置不一致!请重新设置。\ return; }
if(oStrpwd.GetLength()!=16) { myeditresult.SetWindowText(\密钥长度不对!请重新设置。\ return; }
iLen = oStrpwd.GetLength()/2;
char* pcDatapwd = static_cast
Hex2Binary(LPCTSTR(oStrpwd), reinterpret_cast
switch(Fromwhich) {
case FROMCHAR: { myeditchar.GetWindowText(oStr); if(oStr.GetLength()!=8) { myeditresult.SetWindowText(\密文长度不对!请重新输入。\ return; } char* pcData = static_cast
case FROMHEX: { myedithex.GetWindowText(oStr); if(oStr.GetLength()!=16) { myeditresult.SetWindowText(\密文长度不对!请重新输入。\ return;
} iLen = oStr.GetLength()/2; char* pcData = static_cast
case FROMFILE: { CString oStrFile; myeditfile.GetWindowText(oStrFile); if (oStrFile.IsEmpty()) { myeditfile.SetWindowText(\请输入文件名!\ myeditresult.SetWindowText(\ return; } try { CString oStrFile1; oStrFile1=oStrFile+\ oDES.decfile(oStrFile,oStrFile1); myeditresult.SetWindowText(LPCTSTR(oStrFile=\解密后的文件是:\ } catch(exception const& roException) { MessageBox(CString(roException.what()), g_oStrError, MB_OK|MB_ICONERROR); return; } break; } } }
相关推荐: