The interface is as follows:
The key code is as follows:
Void CImmunityUDlg: OnBnClickedButtonOk () {// TODO: add the control notification handler code here TCHAR szPath [MAX_PATH] = {0}; GetDlgItemText (IDC_COMBO_DRIVER, szPath, MAX_PATH ); if (0 = lstrcmp (szPath, _ T ("select the drive letter to be immune... ") {AfxMessageBox (_ T (" silly, please select the drive letter to be immune... "); return;} lstrcat (szPath, AUTORUN); BOOL bRet = CreateDirectory (szPath, NULL); if (! BRet) {AfxMessageBox (_ T ("the drive letter cannot be immune! It may be immune, or the drive letter is not writable! "); Return;} lstrcat (szPath, IMMUNITY); bRet = CreateDirectory (szPath, NULL); if (! BRet) {AfxMessageBox (_ T ("the drive letter cannot be immune! It may be immune, or the drive letter is not writable! ") ;}} Void CImmunityUDlg: OnBnClickedButtonCancel () {// TODO: add the control notification handler code here TCHAR szPath [MAX_PATH] = {0}; GetDlgItemText (IDC_COMBO_DRIVER, szPath, MAX_PATH); lstrcat (szPath, AUTORUN); lstrcat (szPath, IMMUNITY); RemoveDirectory (szPath); ZeroMemory (szPath, MAX_PATH); GetDlgItemText (plaintext, szPath, MAX_PATH ); lstrcat (szPath, AUTORUN); RemoveDirectory (szPath); SetDlgItemText (IDC_COMBO_DRIVER, _ T ("select the drive letter to be immune... "));}
Source code:
Http://pan.baidu.com/s/1i3kff1N