SonicM3
asked on
How can I show the value of a DWORD
when u go into registry and right click a reg dword file and choose modify i can see the value data, how do check that info using delphi to say if for example DWORD value is 1 it will come back and say yes and if it is 0 it will no when the user presses a button on my delphi application?
Shortage of ends:) put above one more ... end;
ASKER
ah thanks man, i am so close can you just finish this off.
i want to go to ... currentversion/polices/sys tem/enable lua and show if 1 is on that yeh admin rights limited access and if its 0 the admin rights have full access
just nearly got it sorted.
how do i edit the code to do this?
i want to go to ... currentversion/polices/sys
just nearly got it sorted.
how do i edit the code to do this?
ASKER
Uses
Registry;
procedure TForm1.Button1Click(Sender : TObject);
var
reg:tregistry;
begin
reg:=Tregistry.Create;
try
reg.RootKey:=HKEY_LOCAL_MA CHINE;
reg.OpenKey('\SOFTWARE\Mic rosoft\Win dows\Curre ntVersion\ polices\sy stem\',fal se);
if reg.ValueExists('enablelua ') then begin
if reg.ReadString ('enablelua')='1' then Button1.Caption:='Yes';
if reg.ReadString ('enablelua')='0' then Button1.Caption:='No';
end;
finally
reg.Free;
end;
end;
Registry;
procedure TForm1.Button1Click(Sender
var
reg:tregistry;
begin
reg:=Tregistry.Create;
try
reg.RootKey:=HKEY_LOCAL_MA
reg.OpenKey('\SOFTWARE\Mic
if reg.ValueExists('enablelua
if reg.ReadString ('enablelua')='1' then Button1.Caption:='Yes';
if reg.ReadString ('enablelua')='0' then Button1.Caption:='No';
end;
finally
reg.Free;
end;
end;
ASKER
This works fine for strings but does not seem to work for DWORD.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
well done mate, top marks!
I will award you points for that but can i ask a quick question.
at the moment i can read fine and i am an admin on limted access basically with lua on, how can i change the 1 to a 0 to turn lua off and give me fulll access.
Like i say point rewarded anyways for the other answer excellent!
I will award you points for that but can i ask a quick question.
at the moment i can read fine and i am an admin on limted access basically with lua on, how can i change the 1 to a 0 to turn lua off and give me fulll access.
Like i say point rewarded anyways for the other answer excellent!
You are more than welcome to ask, add
reg.WriteInteger('EnableLU A',0);
to the code
procedure TForm1.Button1Click(Sender : TObject);
var
reg:tregistry;
begin
reg:=Tregistry.Create;
try
reg.RootKey:=HKEY_LOCAL_MA CHINE;
reg.OpenKey('\SOFTWARE\Mic rosoft\Win dows\Curre ntVersion\ policies\s ystem\',fa lse);
if reg.ValueExists('EnableLUA ') then begin
reg.WriteInteger('EnableLU A',0);
if reg.ReadInteger ('EnableLUA')=1 then Button1.Caption:='Yes';
if reg.ReadInteger ('EnableLUA')=0 then Button1.Caption:='No';
end;
finally
reg.Free;
end;
end;
Regards,
B.
reg.WriteInteger('EnableLU
to the code
procedure TForm1.Button1Click(Sender
var
reg:tregistry;
begin
reg:=Tregistry.Create;
try
reg.RootKey:=HKEY_LOCAL_MA
reg.OpenKey('\SOFTWARE\Mic
if reg.ValueExists('EnableLUA
reg.WriteInteger('EnableLU
if reg.ReadInteger ('EnableLUA')=1 then Button1.Caption:='Yes';
if reg.ReadInteger ('EnableLUA')=0 then Button1.Caption:='No';
end;
finally
reg.Free;
end;
end;
Regards,
B.
ASKER
super! I will add this after lunch.
thanks again
thanks again
ASKER
can you help me figure out why the things dont show?
like.. when i select the button it shows label1 but nothing else, when im logged in as (1) and when im logged in as (0) nothing works..
its like,none of the commands work for the options switch.
procedure TForm1.Button1Click(Sender : TObject);
var
reg:tregistry;
begin
reg:=Tregistry.Create;
try
reg.RootKey:=HKEY_LOCAL_MA CHINE;
reg.OpenKey('\SOFTWARE\Mic rosoft\Win dows\Curre ntVersion\ policies\s ystem\',fa lse);
if reg.ValueExists('EnableLUA ') then begin
if reg.ReadInteger ('EnableLUA')=0
then
label1.show;
button2.show;
button3.show;
if reg.ReadInteger ('EnableLUA')=1 then
label2.Show;
button4.show;
button5.show;
end;
finally
reg.Free;
end;
end;
like.. when i select the button it shows label1 but nothing else, when im logged in as (1) and when im logged in as (0) nothing works..
its like,none of the commands work for the options switch.
procedure TForm1.Button1Click(Sender
var
reg:tregistry;
begin
reg:=Tregistry.Create;
try
reg.RootKey:=HKEY_LOCAL_MA
reg.OpenKey('\SOFTWARE\Mic
if reg.ValueExists('EnableLUA
if reg.ReadInteger ('EnableLUA')=0
then
label1.show;
button2.show;
button3.show;
if reg.ReadInteger ('EnableLUA')=1 then
label2.Show;
button4.show;
button5.show;
end;
finally
reg.Free;
end;
end;
Try this:
procedure TForm1.Button1Click(Sender : TObject);
var
reg:tregistry;
begin
reg:=Tregistry.Create;
try
reg.RootKey:=HKEY_LOCAL_MA CHINE;
reg.OpenKey('\SOFTWARE\Mic rosoft\Win dows\Curre ntVersion\ policies\s ystem\',fa lse);
if reg.ValueExists('EnableLUA ') then begin
if reg.ReadInteger ('EnableLUA')=0 then begin
label1.visible:=true;
button2.visible:=true;
button3.visible:=true;
end;
if reg.ReadInteger ('EnableLUA')=1 then begin
label2.visible:=true;
button4.visible:=true;
button5.visible:=true;
end;
end;
finally
reg.Free;
end;
end;
procedure TForm1.Button1Click(Sender
var
reg:tregistry;
begin
reg:=Tregistry.Create;
try
reg.RootKey:=HKEY_LOCAL_MA
reg.OpenKey('\SOFTWARE\Mic
if reg.ValueExists('EnableLUA
if reg.ReadInteger ('EnableLUA')=0 then begin
label1.visible:=true;
button2.visible:=true;
button3.visible:=true;
end;
if reg.ReadInteger ('EnableLUA')=1 then begin
label2.visible:=true;
button4.visible:=true;
button5.visible:=true;
end;
end;
finally
reg.Free;
end;
end;
ASKER
ur the man!
cheers mate, i just really want to thank you for your help with this stuff. Thankyou so much. If i need another Q, ill make a new topic and give ya more points mate.
cheers
cheers mate, i just really want to thank you for your help with this stuff. Thankyou so much. If i need another Q, ill make a new topic and give ya more points mate.
cheers
Don't worry I am glad that your code is working.
Just...keep typing. :)
Have a good day,
B.
Just...keep typing. :)
Have a good day,
B.
Uses
Registry;
procedure TForm1.Button1Click(Sender
var
reg:tregistry;
begin
reg:=Tregistry.Create;
try
reg.RootKey:=HKEY_LOCAL_MA
reg.OpenKey('\SOFTWARE\Mic
if reg.ValueExists('Some_Valu
if reg.ReadString ('Some_Value')='1' then Button1.Caption:='Yes';
if reg.ReadString ('Some_Value')='0' then Button1.Caption:='No';
end;
finally
reg.Free;
end;