Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 10-25-2003, 12:34 PM
Bashk Bashk is offline
Senior Member
 
Join Date: Nov 2001
Posts: 349
Default using registry as user

Hello!
I get some errors when I try to read/write in registry logged as user. Here is the code:

reg:= TRegistry.Create;
try
reg.RootKey:= HKEY_USERS;
reg.Openkey(mystring1, True);
var1:=reg.ReadString('start');
if var1='' then reg.WriteString('start',DateToStr(Now));
reg.CloseKey;
finally reg.Free
end;


What should I add or change in order not to receive the message "Failed to set data for 'start'." ?

Thank you!

If you answer I'm grateful,
otherwise you should and press "Accept as Answer"

Bashk
Reply With Quote
  #2  
Old 10-25-2003, 01:31 PM
paulholden paulholden is offline
Senior Member
 
Join Date: Jan 2001
Posts: 714
Default RE: using registry as user

From Delphi Help:

If WriteString fails, an exception is raised, and the value is not written to the registry.

Have you tried putting it in a try .. except block? Maybe that will do it.

Please accept as answer if this helped, cheers
Reply With Quote
  #3  
Old 10-26-2003, 05:25 AM
Muhammad Muhammad is offline
Senior Member
 
Join Date: Jan 2003
Posts: 399
Default RE: using registry as user

Hi ...
The problem is not in Delphi it is in the Registry .
you ann't add a key in the root so try to write :

reg.Openkey('.DEFAULT\Test', True);

Programming .... is not a single word
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 11:37 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.