?? regtipsdlg.cpp
字號(hào):
// RegTipsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "RegTips.h"
#include "RegTipsDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRegTipsDlg dialog
CRegTipsDlg::CRegTipsDlg(CWnd* pParent /*=NULL*/)
: CDialog(CRegTipsDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CRegTipsDlg)
m_tmpChar=new char[100];
m_tmpWord=1;
m_Title = _T("");
m_Message = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CRegTipsDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRegTipsDlg)
DDX_Control(pDX, IDC_EDIT1, m_editCtrl);
DDX_Control(pDX, IDC_LIST_REGISTRYTEXT, m_listRegistryText);
DDX_Text(pDX, IDC_EDIT1, m_Title);
DDX_Text(pDX, IDC_STATIC_MESSAGE, m_Message);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRegTipsDlg, CDialog)
//{{AFX_MSG_MAP(CRegTipsDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_LBN_SELCHANGE(IDC_LIST_REGISTRYTEXT, OnSelchangeListRegistrytext)
ON_BN_CLICKED(IDC_BUTTON1, OnAddTip)
ON_BN_CLICKED(IDC_BUTTON2, OnRemoveTip)
ON_BN_CLICKED(IDC_BUTTON_REBOOT, OnWindowsReboot)
ON_BN_CLICKED(IDC_BUTTON_SHUTDOWN, OnWindowsShutdown)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRegTipsDlg message handlers
BOOL CRegTipsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_editCtrl.ShowWindow(SW_HIDE);
m_listRegistryText.AddString("Change The Internet explorer Title");
m_listRegistryText.AddString("Remove Recent Opened Files From Windows Media Player");
m_listRegistryText.AddString("Showing the Windows Version on the Desktop");
m_listRegistryText.AddString("Setting the Internet Explorer Home Page");
m_listRegistryText.AddString("Remove the shortcut arrows from all your icons");
m_listRegistryText.AddString("Adding'Open with Notepad' to the right-click on any file");
m_listRegistryText.AddString("Add 'Open With'when you right-click on any file");
m_listRegistryText.AddString("Add Toolbar Wallpaper to all your windows");
m_listRegistryText.AddString("Removing typed URLs from the Address bar of IE");
m_listRegistryText.AddString("Blocking the Background Sheet");
m_listRegistryText.AddString("Creating 3D Window Effect");
m_listRegistryText.AddString("Turn Off Window Animation");
// m_listRegistryText.AddString("To prevent any changes to the Start Menu");
m_listRegistryText.AddString("Removing the 'Log Off User' from Start Menu");
m_listRegistryText.AddString("Disable 'Shut Down' Option from Start Menu");
m_listRegistryText.AddString("Disable the displaying of drives");
m_listRegistryText.AddString("Removing the 'Run' from Start Menu");
m_listRegistryText.AddString("Removing the 'Find' from Start Menu");
m_listRegistryText.AddString("Removing the 'Documents' from Start Menu");
m_listRegistryText.AddString("Changing the Title of Outlook Express 5");
m_listRegistryText.AddString("Hiding All Items from the Desktop");
m_listRegistryText.AddString("Disable Registry Editing Tools");
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CRegTipsDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CRegTipsDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CRegTipsDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CRegTipsDlg::OnSelchangeListRegistrytext()
{
CString str;
int index=m_listRegistryText.GetCurSel();
m_listRegistryText.GetText(index,str);
if(str.Compare("Change The Internet explorer Title")==0)
{
m_Message="Enter the Your Title name of Internet explorer in Text Box.";
m_editCtrl.ShowWindow(SW_SHOW);
UpdateData(FALSE);
//m_editCtrl.SetWindowText("Enter the Title name");
}
else if(str.Compare("Add Toolbar Wallpaper to all your windows")==0)
{
m_editCtrl.ShowWindow(SW_SHOW);
m_Message="Enter The Path of BMP file name in TextBox like c:\\Windows\\sea.bmp.";
UpdateData(FALSE);
}
else if(str.Compare("Setting the Internet Explorer Home Page")==0)
{
m_Message="Enter The URL Address in TextBox like www.codeguru.com.";
UpdateData(FALSE);
m_editCtrl.ShowWindow(SW_SHOW);
}
else if(str.Compare("Changing the Title of Outlook Express 5")==0)
{
m_editCtrl.ShowWindow(SW_SHOW);
m_Message="Enter the Your Title name of Outlook Express in Text Box.";
UpdateData(FALSE);
}
else if(str.Compare("Creating 3D Window Effect")==0||str.Compare("Turn Off Window Animation")==0||str.Compare("Showing the Windows Version on the Desktop")==0||str.Compare("Disable Registry Editing Tools")==0)
{
m_editCtrl.ShowWindow(SW_HIDE);
m_Message="You Must Restart your Computer to change effect.";
UpdateData(FALSE);
}
else if(str.Compare("Disable 'Shut Down' Option from Start Menu")==0)
{
m_editCtrl.ShowWindow(SW_HIDE);
m_Message="You Must Restart your Computer to change effect OR Restart your Explorer.exe.";
UpdateData(FALSE);
}
else if(str.Compare("Disable the displaying of drives")==0)
{
m_editCtrl.ShowWindow(SW_HIDE);
m_Message="Clicking On 'Add' Button take immediate effect but After clicking 'Remove' Button you must Restart Windows or Explorer.exe.";
UpdateData(FALSE);
}
else if(str.Compare("Remove the shortcut arrows from all your icons")==0|| str.Compare("Removing the 'Run' from Start Menu")==0||str.Compare("Removing the 'Log Off User' from Start Menu")==0||str.Compare("Hiding All Items from the Desktop")==0)
{
m_editCtrl.ShowWindow(SW_HIDE);
m_Message="You Must Restart your Computer to change effect OR Restart your Explorer.exe.";
UpdateData(FALSE);
}
else if(((str.Compare("Removing the 'Documents' from Start Menu")==0)||str.Compare("Removing the 'Find' from Start Menu")==0))
{
m_editCtrl.ShowWindow(SW_HIDE);
m_Message="Clicking On 'Add' Button take immediate effect but After clicking 'Remove' Button you must Restart Windows or Explorer.exe.";
UpdateData(FALSE);
}
else
{
m_editCtrl.ShowWindow(SW_HIDE);
m_Message="No need of Restarting Windows OR Explorer.exe.";
UpdateData(FALSE);
}
}
void CRegTipsDlg::OnAddTip()
{
UpdateData(TRUE);
CString comstr;
HKEY hkey;
int index=m_listRegistryText.GetCurSel();
m_listRegistryText.GetText(index,comstr);
if(comstr.Compare("Change The Internet explorer Title")==0)
{
m_tmpChar=m_Title.GetBuffer(m_Title.GetLength());
RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Internet Explorer\\Main",0,KEY_ALL_ACCESS,&hkey);
RegSetValueEx(hkey,"Window Title",NULL,REG_SZ,(unsigned char*)m_tmpChar,strlen(m_tmpChar)+1);
}
else if(comstr.Compare("Changing the Title of Outlook Express 5")==0)
{
DWORD nSize=50;
char userID[100];
RegOpenKey(HKEY_CURRENT_USER,"Identities",&hkey);
RegQueryValueEx(hkey,"Default User ID",0,0,(unsigned char*)userID,&nSize);
m_tmpChar=m_Title.GetBuffer(m_Title.GetLength()); //{3D84BC00-2D58-11D7-8E57-FACFD4E14C3E}
RegOpenKeyEx(hkey,userID,0,KEY_ALL_ACCESS,&hkey);
RegOpenKeyEx(hkey,"Software\\Microsoft\\Outlook Express\\5.0",0,KEY_ALL_ACCESS,&hkey);
RegSetValueEx(hkey,"WindowTitle",NULL,REG_SZ,(unsigned char*)m_tmpChar,strlen(m_tmpChar)+1);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -