Internet选项设置-C++


安全等级 添加网站列表 弹出窗口 设置代理服务器 C++,IE浏览器的一些常规设置,主要是找到对应的注册表,全部在IE11实践成功。 如果没有积分,请私信我留下邮箱,我会尽快发过去
资源截图
代码片段和文件信息
// localInternet.cpp : Defines the entry point for the console application.
//

#include “stdafx.h“
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;
#pragma comment(lib“wininet.lib“)//InternetSetOption 函数使用

void SetValue()//设置安全等级等的值,第一步
{
DWORD dwtype sl = 256; 
int sz[256]; 
HKEY  hKeyResult = NULL;
string strUrl = “Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3“;//安全级别
//string strUrl = “Software\Microsoft\Internet Explorer\New Windows“;//组织弹出  PopupMgr
//string strUrl = “Software\Microsoft\Internet Explorer\Download“;//允许运行或安装软件,即使签名无效 RunInvalidSignatures  第四步



if(ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_CURRENT_USER strUrl.c_str() 0 KEY_ALL_ACCESS &hKeyResult))
{
printf(“RegOpenKeyEx success!
“);

}

if(ERROR_SUCCESS ==RegQueryValueEx(hKeyResult “CurrentLevel“ NULL &dwtype (LPBYTE)sz &sl))

{
printf(“RegQueryValueEx success!
“);

}

//12000级别为高,十进制73728;11500,十进制70912;11000,十进制69632
DWORD m_newValue = 73728;//设置需要进行改变的值;

if(ERROR_SUCCESS ==RegSetValueEx(hKeyResult “CurrentLevel“ NULLREG_DWORD(unsigned char*)&m_newValuesizeof(DWORD)))
{
printf(“RegSetValueEx success!
“);

}
RegCloseKey(hKeyResult); 
}


int __stdcall GetCountOfSite()//选择受信任站点
{
int iRet = 0;

CString str strTemp;
str.Format(“%d“iRet+1);
CString strKeyName = “Range“ + str;

HKEY hKEY;
HKEY hKeyRoot = HKEY_CURRENT_USER;
LPCTSTR lp = “Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\“;
while(::RegOpenKeyEx(hKeyRoot lp + strKeyName 0 KEY_READ &hKEY) == ERROR_SUCCESS)//如果无法打开hKEY则中止程序的执行
{
++iRet;
str.Format(“%d“iRet+1);
strKeyName = “Range“ + str;
}

::RegCloseKey(hKEY);

return iRet;
}

void AddSite()//添加受信任的站点的网站列表
{
CString strSite = “https://0000“; //此处即为需要添加的网站地址

int iIndex = strSite.Find(“:“);
CString strIp = strSite.Mid(iIndex+3);
CString strHead = strSite.Left(iIndex+3);
if (((strHead == “http://“) || (strHead == “https://“)))
{
//查找注册表Index
int iCount = GetCountOfSite();

//插入注册表
DWORD dwData = 2;
CString str strTemp;
str.Format(“%d“iCount+1);
CString strKeyName = “Range“ + str;

DWORD dwTemp;
HKEY hKEY;
HKEY hKeyRoot = HKEY_CURRENT_USER;
LPCTSTR lp = “Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\“;
if(::RegCreateKeyEx(hKeyRoot lp + strKeyName 0 REG_NONE REG_OPTION_NON_VOLATILE KEY_ALL_ACCESS NULL &hKEY &dwTemp) == ERROR_SUCCESS)
{
::RegSetValueEx(hKEY “:Range“ 0 REG_SZ (BYTE*)strIp.GetBuffer() strIp.GetLength());
::RegSetValueEx(hKEY (strHead.Left(strHead.Find(“:“))).GetBuffer() 0 REG_DWORD (BYTE*)&dwData sizeof(DWORD));            
}

::RegCloseKey(hKEY);

}
}


void SetValuePop()//设置弹出窗口阻止程序
{
DWORD dwtype sl = 256; 
int sz[256]; 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-05-09 10:21  localInternet
     目录           0  2018-05-09 10:01  localInternetDebug
     文件      103936  2018-05-09 10:02  localInternetDebuglocalInternet.exe
     文件      689732  2018-05-09 10:02  localInternetDebuglocalInternet.ilk
     文件     1272832  2018-05-09 10:02  localInternetDebuglocalInternet.pdb
     目录           0  2018-05-09 10:21  localInternetRelease
     文件       17920  2018-05-09 10:21  localInternetReleaselocalInternet.exe
     文件      650240  2018-05-09 10:21  localInternetReleaselocalInternet.pdb
     目录           0  2018-05-09 10:21  localInternetlocalInternet
     目录           0  2018-05-09 10:02  localInternetlocalInternetDebug
     文件        7402  2018-05-09 10:02  localInternetlocalInternetDebugBuildLog.htm
     文件         663  2018-05-09 10:01  localInternetlocalInternetDebuglocalInternet.exe.embed.manifest
     文件         728  2018-05-09 10:01  localInternetlocalInternetDebuglocalInternet.exe.embed.manifest.res
     文件         621  2018-05-09 10:02  localInternetlocalInternetDebuglocalInternet.exe.intermediate.manifest
     文件      203133  2018-05-09 10:02  localInternetlocalInternetDebuglocalInternet.obj
     文件     4128768  2018-05-09 10:01  localInternetlocalInternetDebuglocalInternet.pch
     文件          67  2018-05-09 10:02  localInternetlocalInternetDebugmt.dep
     文件       11797  2018-05-09 10:01  localInternetlocalInternetDebugstdafx.obj
     文件      592896  2018-05-09 10:02  localInternetlocalInternetDebugvc90.idb
     文件      520192  2018-05-09 10:02  localInternetlocalInternetDebugvc90.pdb
     文件        1338  2018-05-09 09:23  localInternetlocalInternetReadMe.txt
     目录           0  2018-05-09 10:21  localInternetlocalInternetRelease
     文件        8670  2018-05-09 10:21  localInternetlocalInternetReleaseBuildLog.htm
     文件         616  2018-05-09 10:21  localInternetlocalInternetReleaselocalInternet.exe.intermediate.manifest
     文件     1161123  2018-05-09 10:21  localInternetlocalInternetReleaselocalInternet.obj
     文件     4128768  2018-05-09 10:21  localInternetlocalInternetReleaselocalInternet.pch
     文件          67  2018-05-09 10:21  localInternetlocalInternetReleasemt.dep
     文件       67805  2018-05-09 10:21  localInternetlocalInternetReleasestdafx.obj
     文件      232448  2018-05-09 10:21  localInternetlocalInternetReleasevc90.idb
     文件      421888  2018-05-09 10:21  localInternetlocalInternetReleasevc90.pdb
     文件        6233  2018-05-09 10:21  localInternetlocalInternetlocalInternet.cpp
............此处省略8个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)