开启UAC的windows7下写注册表出错
TRegistry *Reg=new TRegistry();
Reg->RootKey=HKEY_LOCAL_MACHINE;
if(Reg->OpenKey("Software\\Microsoft\\Windows\\Currentversion\\Run",false))
{
Reg->WriteString("aaa","aaa");
Reg->CloseKey();
}
delete Reg;
Reg = NULL;
代码如上,开发工具为bcb6,关闭uac就能正常执行上面的代码,如果打开uac执行到Reg->WriteString("aaa","aaa");这段就会提示"Failed to set data for 'aaa'",在网上找了一下,发现没有相应的资料,这类问题该怎么处理,请求高手帮助....
[解决办法]
不知道的帮顶,一直没有涉足win7其实芯片挺好的,呵呵
[解决办法]
你先试试用管理权限来运行看会不会报错,如果不会报错了,就直接在资源中加个XML定义就可以了。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="9el.NetDocBook"
type="win32"
/>
<description>DocBook</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>