We help IT Professionals succeed at work.

registered organisation

nod31
nod31 asked
on
Medium Priority
218 Views
Last Modified: 2010-04-06
how can i change the registered user using an editbox to enter the user and a button?


nod31
Comment
Watch Question

Software Developer
CERTIFIED EXPERT
Commented:
if you mean for windows?, you can do that by chaning the information in the registry

procedure TForm1.Button1Click(Sender: TObject);
var
  Registry: TRegistry;
  S:  string ;
begin
  Registry:=TRegistry.Create;
  Registry.RootKey:=HKEY_LOCAL_MACHINE;
  Registry.OpenKey('\SOFTWARE\Microsoft\Windows\CurrentVersion',False);
  Registry.WriteString('RegisteredOwner', Edit1.Text);
  Registry.WriteString('RegisteredOrganization', Edit2.Text);
  Registry.Free;
end;

Best regards
Mohammed Nasman
Mohammed NasmanSoftware Developer
CERTIFIED EXPERT

Commented:
sorry there's no need for variable S
just remove this line :
  S:  string ;

:o)

Commented:
On NT and 2000 the key will be
\SOFTWARE\Microsoft\Windows NT\CurrentVersion

so

function SetWinRegInfo(const Owner, Organization: string): boolean;
begin
  result := false;
  with TRegistry.Create do
  try
    LazyWrite := false;
    RootKey := HKEY_LOCAL_MACHINE;
    if OpenKey('\SOFTWARE\Microsoft\Windows NT\CurrentVersion',False) or OpenKey('\SOFTWARE\Microsoft\Windows\CurrentVersion',False) then
    begin
      WriteString('RegisteredOwner',Owner);
      WriteString('RegisteredOrganization',Organization);
      result := true;
    end;
  finally
    Free;
  end;
end;

Explore More ContentExplore courses, solutions, and other research materials related to this topic.