Solved

Modifying the (Default) value in a registrykey.

Posted on 2001-08-05
6
527 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
Comment Utility
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 24 total points
Comment Utility
Reg.WriteString('', '1');

Regards, Madshi.
0
 

Author Comment

by:tyfing
Comment Utility
RenameValue(const OldName, NewName: String);

what do u mean ? i tried b4 but i am not sure of the method
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 21

Expert Comment

by:gemarti
Comment Utility
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
Comment Utility
i want to change the value of (Default) from 'value not set' to '1'.
0
 
LVL 21

Expert Comment

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

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now