Vc ++ automatically starts and cancels startup, vc cancels
// Start int CMainWnd: CreateRun () {// Add the following code HKEY hKey; char pFileName [MAX_PATH] = {0 }; // obtain the full path of the program. DWORD dwRet = GetModuleFileNameW (NULL, (LPWCH) pFileName, MAX_PATH ); // find the system startup Item maid ("Software \ Microsoft \ Windows \ CurrentVersion \ Run "); // open the startup Key long lRet = RegOpenKeyEx (HKEY_LOCAL_MACHINE, lpRun, 0, KEY_WRITE, & hKey); if (lRet = ERROR_SUCCESS) {// Add registry RegSetValueEx (hKey, _ T ("UilibDemo"), 0, REG_SZ, (const BYTE *) (LPCSTR) pFileName, MAX_PATH); RegCloseKey (hKey);} return 0 ;} // cancel startup int CMainWnd: DeleteRun () {// Add the following code HKEY hKey; char pFileName [MAX_PATH] = {0 }; // obtain the full path of the program. DWORD dwRet = GetModuleFileNameW (NULL, (LPWCH) pFileName, MAX_PATH ); // find the system startup Item maid ("Software \ Microsoft \ Windows \ CurrentVersion \ Run "); // open the startup Key long lRet = RegOpenKeyEx (HKEY_LOCAL_MACHINE, lpRun, 0, KEY_WRITE, & hKey); if (lRet = ERROR_SUCCESS) {// Delete registered RegDeleteValue (hKey, _ T ("UilibDemo"); RegCloseKey (hKey) ;}return 0 ;}
You can run the regedit command to view the data in the registry.