?? autorun.cpp
字號:
// AutoRun.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "AutoRun.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
HKEY hKey;
// 創建注冊表鍵項
if(!RegCreateKey(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",&hKey))
{
CString strKey;
char cSysPath[MAX_PATH];
// 獲得當前系統目錄
::GetSystemDirectory(cSysPath,MAX_PATH);
// 設置自啟動的程序名稱
strKey = cSysPath;
strKey += "\\AutoRun.EXE";
// 設置注冊表鍵值為自啟動程序名稱
RegSetValueEx(hKey,
"AutoRun",
0,
REG_SZ,
(LPBYTE)strKey.GetBuffer(0),
strKey.GetLength()
);
}
}
return nRetCode;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -