Help!!关于注册表的问题?在线等!

时间:2022-06-01 21:17:34
下面的代码为什么运行出错?
‘failed to set date for 'ForceActiveDesktopOn'’
关键是如何设置REG_DWORD
str1:='1';
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer',false);
Reg.WriteBinaryData('ForceActiveDesktopOn',str1,sizeof(str1));
Systemparametersinfo(SPI_SETDESKWALLPAPER,0,nil,SPIf_SendChange);
Reg.CloseKey;
Reg.Free;
systemparametersinfo(SPI_SETDESKWALLPAPER ,0,pchar('c:\1.htm'),SPIF_UPDATEINIFILE );


16 个解决方案

#1


gz,看不出来错

#2


字符串不能给二进制数据赋植

#3


把str1改为integer类型

#4


Reg.WriteBinaryData的参数是一个指针和一个长度
你可以这样:
var
l:integer;
p:pchar;
begin
p:='ForceActiveDesktopOn';
l:=length(p);
Reg.WriteBinaryData(p,l,sizeof(l));

#5


你们说的好象都不行!!!!

#6


>>str1:=1;//integer;
>>Reg.Writeinteger('ForceActiveDesktopOn',str1);

#7


ForceActiveDesktopOn是DWORD 值

#8


这个方法我试过不行!!!

能给其他的方法吗?
这个问题好象不难吧?对与高手!

#9


是我的 机器有毛病吗?

#10


var
str1 : dword

Reg.WriteBinaryData('ForceActiveDesktopOn',str1,sizeof(str1));

#11


str1我怎样付植??

#12


str1:Dword可str怎样付植呢?
str1=1吗?我试过好象还是不行!!

#13


str1:='1';
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer',false);
Reg.WriteBinaryData('ForceActiveDesktopOn',str1,sizeof(str1));

Reg.CloseKey;
Reg.Free;

Systemparametersinfo(SPI_SETDESKWALLPAPER,0,nil,SPIf_SendChange);
systemparametersinfo(SPI_SETDESKWALLPAPER ,0,pchar('c:\1.htm'),SPIF_UPDATEINIFILE );
交换一下语句的顺序。还有就是不知道在你的user中是否有注册表单元

#14


你说的我都试过,不行。
不知,为什么?

#15


难道解决不了这个问题吗?各为高手!!

#16


help

#1


gz,看不出来错

#2


字符串不能给二进制数据赋植

#3


把str1改为integer类型

#4


Reg.WriteBinaryData的参数是一个指针和一个长度
你可以这样:
var
l:integer;
p:pchar;
begin
p:='ForceActiveDesktopOn';
l:=length(p);
Reg.WriteBinaryData(p,l,sizeof(l));

#5


你们说的好象都不行!!!!

#6


>>str1:=1;//integer;
>>Reg.Writeinteger('ForceActiveDesktopOn',str1);

#7


ForceActiveDesktopOn是DWORD 值

#8


这个方法我试过不行!!!

能给其他的方法吗?
这个问题好象不难吧?对与高手!

#9


是我的 机器有毛病吗?

#10


var
str1 : dword

Reg.WriteBinaryData('ForceActiveDesktopOn',str1,sizeof(str1));

#11


str1我怎样付植??

#12


str1:Dword可str怎样付植呢?
str1=1吗?我试过好象还是不行!!

#13


str1:='1';
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer',false);
Reg.WriteBinaryData('ForceActiveDesktopOn',str1,sizeof(str1));

Reg.CloseKey;
Reg.Free;

Systemparametersinfo(SPI_SETDESKWALLPAPER,0,nil,SPIf_SendChange);
systemparametersinfo(SPI_SETDESKWALLPAPER ,0,pchar('c:\1.htm'),SPIF_UPDATEINIFILE );
交换一下语句的顺序。还有就是不知道在你的user中是否有注册表单元

#14


你说的我都试过,不行。
不知,为什么?

#15


难道解决不了这个问题吗?各为高手!!

#16


help