Solved

Modifying the (Default) value in a registrykey.

Posted on 2001-08-05
6
533 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
[X]
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
  • 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
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

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!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…

751 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