界面如下:
關鍵部分代碼如下:
void CImmunityUDlg::OnBnClickedButtonOk() { // TODO: 在此添加控件通知處理程序代碼 TCHAR szPath[MAX_PATH] = {0}; GetDlgItemText(IDC_COMBO_DRIVER, szPath, MAX_PATH); if (0 == lstrcmp(szPath, _T("請選擇欲免疫的盤符..."))) { AfxMessageBox(_T("傻逼,請選擇欲免疫的盤符...")); return; } lstrcat(szPath, AUTORUN); BOOL bRet = CreateDirectory(szPath, NULL); if (!bRet) { AfxMessageBox(_T("無法免疫該盤符!可能已經免疫,或者該盤符為不可寫狀態!")); return; } lstrcat(szPath, IMMUNITY); bRet = CreateDirectory(szPath, NULL); if (!bRet) { AfxMessageBox(_T("無法免疫該盤符!可能已經免疫,或者該盤符為不可寫狀態!")); } } void CImmunityUDlg::OnBnClickedButtonCancel() { // TODO: 在此添加控件通知處理程序代碼 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(IDC_COMBO_DRIVER, szPath, MAX_PATH); lstrcat(szPath, AUTORUN); RemoveDirectory(szPath); SetDlgItemText(IDC_COMBO_DRIVER, _T("請選擇欲免疫的盤符...")); }
源代碼下載地址:
http://pan.baidu.com/s/1i3kff1N