Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I can't create a value in Windows registry

Status
Not open for further replies.

PhaseR

Programmer
Jul 30, 2000
1
CM
I want to create a value in Windows registry and i didn't find anything to do this. Can anyoane help me?
 
Try this code below. <br><br>&nbsp;&nbsp;Registry := TRegistry.Create;<br>&nbsp;&nbsp;try<br>&nbsp;&nbsp;&nbsp;&nbsp;Registry.RootKey := &lt;eg HKEY_LOCAL_MACHINE&gt;;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Registry.OpenKey(&lt;Relative path&gt;, true);<br>&nbsp;&nbsp;&nbsp;&nbsp;Registry.WriteString(Name, Text);<br>&nbsp;&nbsp;finally<br>&nbsp;&nbsp;&nbsp;&nbsp;Registry.Free;<br>&nbsp;&nbsp;end;<br>
 
And how about making a file that can open by default, for example I have database file with extension '.tes', and I have a program that can open it, for example 'test.exe'

the problem is when I double click the .tes file, the Test.Exe isn't open by default, it just show the .tes contents file by notepad (so the default is notepad), and when I try to change the default into test.exe program (from Folder Options), in registry there is a binary value that has name ='EditFlags' and has value 00 00 00 00, and I think that this EditFlags made my .tes file opened by test.exe.....

and also, how to make my program (test.exe) so when the user put command = &quot; test xxxxx.tes&quot; then the test.exe program run and open the database file (which in this example is xxxxx.tes)

thank you....
 
Hi,

write the following value to the registry:
HKEY_CLASSES_ROOT\.tes\shell\open\command
(default) = c:\mypath\myprogram.exe &quot;%1&quot;

Now, in your program use the following code for the commandline:

var
FileName: String;

if (ParamCount()>0) then
begin
FileName := ParamStr(1);
end;

FileName now contains the name filename of the file on the commandline.

I hope this helps.

Best Regards,

Thijs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top