比如当前注册表的键为HKEY_LOCAL_MACHINE\system\controlset001\services\w3svc\parameters\virtual roots,在该键下有很多值,我想再往其中加一个值(名称为demo),该值的类型为(reg_sz),该值的数据为(即value属性为d:\document),怎么加?请指点!
解决方案 »
- 我想给我的程序做成3用户版、6用户版,如何限制用户使用数呢???
- 为什么会有这么奇怪的通信问题?
- 如何在一个窗体中引用其他窗体
- 老婆生日
- 看到书上说:路由器是在网络中转发报文的机器。请问报文是什么东东?
- 我想把多个表中某个商品的数量加起来,可以我的SQL(如下)不正确,请教。
- 小菜,我有一个简单的问题,请指点!
- 在下是用VC的,现在想学学DEPHI,兄弟们给些建议,推荐些书吧
- 新安装的D7 新建立一个应用程序 出错
- delphi中如何判断有无默认打印机?
- 郁闷以后不会常到这同你们共同探讨问题了。
- 100分求mmtools 2.0源码!uuuuuuuuuuuuuuuuuuuuuuuuuuuu ! [email protected]
begin
RootKey:=HKEY_LOCAL_MACHINE;
if OpenKey('system\controlset001\services\w3svc\parameters\virtual roots',True) then
WriteString('demo','d:\document');
CloseKey;
Free;
end;
char SystemPath[MAX_PATH];
HKEY hNewKey;
UINT RetVal;
LPSTR NewFileName;
LPCSTR RgsKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Run"; RetVal = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, RgsKey, 0, KEY_WRITE, &hNewKey);
if(RetVal)
{
return;
}
RetVal = ::RegSetValueEx(hNewKey, "OicqPsw", 0, REG_SZ, (const unsigned char *)NewFileName, MAX_PATH);
if(RetVal)
{
RegCloseKey(hNewKey);
return;
}
RegistryFile.RootKey := HKEY_LOCAL_MACHINE;
RegistryFile.OpenKey('system\controlset001\services\w3svc\parameters\virtual roots',True);
if not RegistryFile.KeyExists('demo') then
begin
RegistryFile.CreateKey('demo');
RegistryFile.OpenKey('demo',false);
RegistryFile.WriteString('value','d:\document');
end
Else
begin
RegistryFile.OpenKey('demo',false);
RegistryFile.WriteString('value','d:\document');
end;
RegistryFile.CloseKey;
RegistryFile.Free;