Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Modifying the (Default) value in a registrykey.

Posted on 2001-08-05
6
Medium Priority
?
547 Views
Last Modified: 2008-03-10
var
reg:=tregistry;
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.createKey('Software\Microsoft\Windows\CurrentVersion\Policies\System');
Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Policies\System', true);
Reg.WriteString('(Default)','1');
end;

upon running the command, the value for '(Default)' remains at 'value not set'. i do not have a problem setting the values for other stuff except for the prime (Default) value for every key.

please help
0
Comment
Question by:tyfing
  • 3
  • 2
6 Comments
 
LVL 21

Expert Comment

by:gemarti
ID: 6352888
I'm sure you have to rename the '(default)' value before you can assign data to it.

RenameValue(const OldName, NewName: String);
0
 
LVL 20

Accepted Solution

by:
Madshi earned 96 total points
ID: 6352966
Reg.WriteString('', '1');

Regards, Madshi.
0
 

Author Comment

by:tyfing
ID: 6364647
RenameValue(const OldName, NewName: String);

what do u mean ? i tried b4 but i am not sure of the method
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 21

Expert Comment

by:gemarti
ID: 6364849
MadShi had the correct solution. I didn't test, I just posted what works for other portions of the key.

var
reg:tregistry;
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.createKey('Software\Microsoft\Windows\CurrentVersion\Policies\System');
Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Policies\System', true);
Reg.RenameValue('(Default)','Default');
Reg.WriteString('Default','1');
end;

creates a new value name

Default Reg_Sz 1

but you still have

(Default) REG_SZ (value not set)


0
 

Author Comment

by:tyfing
ID: 6364877
i want to change the value of (Default) from 'value not set' to '1'.
0
 
LVL 21

Expert Comment

by:gemarti
ID: 6364901
Yes. Madshi's method works.
reg.WriteString('',1);
Did you test?
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question