www.pudn.com > SafeClean.rar > Rulez.cpp


// Rulez.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "SafeClean.h" 
#include "Rulez.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// Rulez dialog 
 
CString Getme; 
Rulez::Rulez(CWnd* pParent /*=NULL*/) 
	: CDialog(Rulez::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(Rulez) 
	m_Ruletext = _T(""); 
	//}}AFX_DATA_INIT 
 
} 
 
 
void Rulez::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(Rulez) 
	DDX_Control(pDX, ID_ONACCEPT, m_Accept); 
	DDX_Text(pDX, IDC_RULETEXT, m_Ruletext); 
	DDV_MaxChars(pDX, m_Ruletext, 10); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(Rulez, CDialog) 
	//{{AFX_MSG_MAP(Rulez) 
	ON_BN_CLICKED(ID_ONACCEPT, OnOnaccept) 
	ON_BN_CLICKED(IDC_EDIT_RULES, OnEditRules) 
	ON_BN_CLICKED(IDC_CLEAR_RULES, OnClearRules) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// Rulez message handlers 
 
void Rulez::OnOnaccept()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(TRUE); 
	//MessageBox(m_Ruletext); 
	if(m_Ruletext.Left(1) == ' ') {{m_Ruletext.TrimLeft();} } 
	FILE *rules; 
	rules = fopen("c:\\Temp\\Rules.ini","a+"); 
	if(rules==NULL){ 
		AfxMessageBox("             ERROR! \n It seems that you have not installed this product on c drive.\n Install/ReInstall the product on C-Drive only as is.   \n    Rules.ini file missing \nElse mail the author for other reason. "); 
		exit(0); 
	} 
	fprintf(rules,"[Rule]= %s %d\n",m_Ruletext,m_Ruletext.GetLength()); 
	fclose(rules); 
	 
m_Ruletext = _T(" "); 
UpdateData(FALSE); 
 
} 
 
void Rulez::OnEditRules()  
{ 
	// TODO: Add your control notification handler code here 
	WinExec("notepad.exe C:\\Program Files\\Nexus CompuSoft Tech\\Safe-Clean\\Program\\Rules.ini",SW_SHOW);  
} 
 
void Rulez::OnClearRules()  
{ 
	// TODO: Add your control notification handler code here 
	FILE *RULES; 
	RULES = fopen("c:\\Temp\\Rules.ini","w+"); 
	if(RULES==NULL) 
	{ 
 
    AfxMessageBox(" ERROR! \n It seems that you have not installed this product on c drive.\n Install/ReInstall the product on C-Drive only as is.   \n Rules.ini file missing.\n   Else mail the author for other reason. "); 
	exit(0); 
 
	} 
	AfxMessageBox("Cleared."); 
	fprintf(RULES,"[Rule]= .aaa 4\n"); 
	fclose(RULES); 
}