Enable 'Allow programaticclipboard access" for IE.
来源:互联网 发布:货到付款订单系统源码 编辑:程序博客网 时间:2024/06/05 15:43
1. for current user. They can simply modify belowregistry. 0=Enable, 1=Prompt
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings\Zones\2]
"1407"=dword:00000000
2.Use Group Policy API for all users. Maybe the app need haveAdministrator right.
Policy settings are specified by an administrator. This is incontrast to profile settings, that are specified by a user.
Below is C++ example to enable “'Allow programaticclipboard access”
#define INITGUID
#include <Guiddef.h>
#include <Prsht.h>
#include <Gpedit.h>
#define GPO_IE_REG_ZONE_2_PATH _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\InternetSettings\\Zones\\2")
BOOL SetGroupPolicy(HKEY hKey, LPCTSTR subKey, LPCTSTRvalueName, DWORD dwType, const BYTE* szkeyValue, DWORD dwkeyValue) ;
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
DWORD dwEnable = 0;
CoInitialize(NULL);
SetGroupPolicy(HKEY_LOCAL_MACHINE,GPO_IE_REG_ZONE_2_PATH,_T("1407"),REG_DWORD,NULL,dwEnable);
::CoUninitialize();
return 0;
}
BOOL SetGroupPolicy(HKEY hKey, LPCTSTR subKey, LPCTSTRvalueName, DWORD dwType, const BYTE* szkeyValue, DWORD dwkeyValue)
{
HKEY ghKey, ghSubKey, hSubKey;
LPDWORD flag = NULL;
IGroupPolicyObject *pGPO = NULL;
HRESULT hr =CoCreateInstance(CLSID_GroupPolicyObject, NULL, CLSCTX_ALL,IID_IGroupPolicyObject, (LPVOID*)&pGPO);
if(!SUCCEEDED(hr))
{
return FALSE;
}
if (RegCreateKeyEx(hKey, subKey, 0,NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hSubKey, flag) !=ERROR_SUCCESS)
{
return FALSE;
}
if(dwType == REG_SZ)
{
if(RegSetValueEx(hSubKey,valueName, 0, dwType, szkeyValue, strlen((char*)szkeyValue) + 1) !=ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
returnFALSE;
}
}
else if(dwType == REG_DWORD)
{
if(RegSetValueEx(hSubKey,valueName, 0, dwType, (BYTE*)&dwkeyValue, sizeof(dwkeyValue)) !=ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
returnFALSE; }
}
if(!SUCCEEDED(hr))
{
return FALSE;
}
if(pGPO->OpenLocalMachineGPO(GPO_OPEN_LOAD_REGISTRY)!= S_OK)
{
returnFALSE;
}
if(pGPO->GetRegistryKey(GPO_SECTION_USER,&ghKey)!= S_OK)
{
returnFALSE;
}
if(RegCreateKeyEx(ghKey, subKey, 0,NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &ghSubKey, flag) !=ERROR_SUCCESS)
{
RegCloseKey(ghKey);
return FALSE;
}
if(dwType == REG_SZ)
{
if(RegSetValueEx(ghSubKey,valueName, 0, dwType, szkeyValue, strlen((char*)szkeyValue) + 1) !=ERROR_SUCCESS)
{
RegCloseKey(ghKey);
RegCloseKey(ghSubKey);
returnFALSE;
}
}
else if(dwType == REG_DWORD)
{
if(RegSetValueEx(ghSubKey,valueName, 0, dwType, (BYTE*)&dwkeyValue, sizeof(dwkeyValue)) !=ERROR_SUCCESS)
{
RegCloseKey(ghKey);
RegCloseKey(ghSubKey);
return FALSE; }
}
GUID RegistryId = REGISTRY_EXTENSION_GUID;
if(pGPO->Save(false, true,const_cast<GUID*>(&RegistryId),const_cast<GUID*>(&CLSID_GPESnapIn)) != S_OK)
{
RegCloseKey(ghKey);
RegCloseKey(ghSubKey);
return FALSE;
}
pGPO->Release();
RegCloseKey(ghKey);
RegCloseKey(ghSubKey);
return TRUE;
}
- Enable 'Allow programaticclipboard access" for IE.
- Access-Control-Allow-Origin
- Mark!!! enable compatibility mode to allow modification.
- enable/disable ie proxy
- Access-Control-Allow-Origin 解决方法
- 跨域 Access-Control-Allow-Origin
- Access-Control-Allow-Origin问题
- Access-Control-Allow-Origin 错误
- iconFont Access-Control-Allow-Origin
- Access-Control-Allow-Origin 跨域
- Allow Debugging for SharePoint
- Allow No 'Access-Control-Allow-Origin' header is present
- 1.6 pointer allow for flexibility
- allow for 4x expansion
- Access-Control-Allow-Origin与跨域
- html5 cocos2d js Access-Control-Allow-Origin
- Access-Control-Allow-Origin与跨域
- Access-Control-Allow-Origin与跨域
- PhoneGap-Accelerometer(phoneGap加速计小解)
- 查看core文件方法
- STL容器 vector,list,deque 性能比较
- SP2010可视化WebPart利用Respose方法导出Excel后页面按钮失效的解决方法
- sicily--1765. 笨小猴
- Enable 'Allow programaticclipboard access" for IE.
- 17.创建作战单位——工厂方法、抽象工厂
- [USACO]Calf Flac -- 时间复杂度还是略高
- 如何杀掉进程
- 最小树形图
- Win32汇编--如何使用资源 [菜单和加速键]
- hmtl 网页缓存的几个方法总结
- Android-拦截接收短信
- Fedora set JAVA_HOME