Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Modifying the (Default) value in a registrykey.

Posted on 2001-08-05
6
531 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 24 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Printing problem 2 102
Multiple image collision 13 80
Tviruailstringtree sort multi columns on header click 1 74
How to load 2 images in same column in Delphi 2 57
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

856 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