美文网首页C++
C++设置取消程序开机自启动

C++设置取消程序开机自启动

作者: 刘千予 | 来源:发表于2018-06-30 18:06 被阅读0次

/******************************************************************************************

Function:        CancelAutoStart

Description:    设置取消程序开机自启动

*******************************************************************************************/

void dxir::Base::CancelAutoStart()

{

Base base;

HKEY hKey;

std::string strRegPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";

try

{

//1、找到系统的启动项 

if (RegOpenKeyEx(HKEY_CURRENT_USER, base.stringToLPCWSTR(strRegPath), 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)

{

//2、删除值

RegDeleteValue(hKey, base.stringToLPCWSTR("DXIR"));

//3、关闭注册表

RegCloseKey(hKey);

}

}

catch (std::exception e)

{

}

}

相关文章

网友评论

    本文标题:C++设置取消程序开机自启动

    本文链接:https://www.haomeiwen.com/subject/ocfxuftx.html