Board index » delphi » Associating File Types

Associating File Types

How do i edit the registry to associate file typs?
Check Me out at : Http://members.aol.com/m3th0d
Email :M3t...@aol.com
Tons of Nice Shit

 

Re:Associating File Types


M3th0d,
  The easiest way I've found to do this is to modify the Extensions section
of the win.ini file that is located in the Windows directory.  This also
works under Win 95 and will update the registry automatically under Win95.
Look at the extensions section of the win.ini to see the format you have to
use.  Put IniFiles in your uses clause and then use something like this:

var
  INIFile: TIniFile;
begin
  try
    INIFile := TInifile.Create('WIN.INI');
    INIFile.WriteString('Extensions','txt','c:\windows\notepad.exe ^.txt');
  finally
    INIFile.Free;
  end;
end;

This would associate *.txt files with Windows Notepad.  If you had an app
named MyApp in the c:\MyApps directory and your extension was *.MAP then
you would change it like this:

var
  INIFile: TIniFile;
begin
  try
    INIFile := TInifile.Create('WIN.INI');
    INIFile.WriteString('Extensions','map','c:\myapps\myapp.exe ^.map');
  finally
    INIFile.Free;
  end;
end;

This will work in both Win 3.11 and Win 95 and saves you from having to
modify the Reqistry under Win 95.  Not sure about Win NT since I don't have
a test machine available.

Hope this helps!
--

Rodney E Geraghty
GERA-Tech
Ottawa, Canada
gera...@ibm.net

M3th0d <m3t...@aol.com> wrote in article
<19970831232301.TAA14...@ladder02.news.aol.com>...

Quote
> How do i edit the registry to associate file typs?
> Check Me out at : Http://members.aol.com/m3th0d
> Email :M3t...@aol.com
> Tons of Nice Shit

Other Threads