Board index » delphi » Filetypes

Filetypes

I have a file: testfile.cdcr

I know how to associate the file with my program. In Explorer, I double
click the file and it will open my program but not the file.

How can I get my program to open the file when double clicking in Windows
Explorer?

Thanks.

 

Re:Filetypes


You have to actually code your program so that it opens the file!
See ParamCount and ParamStr in the help.

Bob Downing <bobsfly...@yahoo.com> skrev i en
nyhedsmeddelelse:7p9bf7$ka...@newsfeed.niagara.com...

Quote
> I know how to associate the file with my program. In Explorer, I double
> click the file and it will open my program but not the file.
> How can I get my program to open the file when double clicking in Windows
> Explorer?

Re:Filetypes


In article <7p9bf7$ka...@newsfeed.niagara.com>, "Bob Downing"

Quote
<bobsfly...@yahoo.com> writes:
>I know how to associate the file with my program. In Explorer, I double
>click the file and it will open my program but not the file.

>How can I get my program to open the file when double clicking in Windows
>Explorer?

>Thanks.

I do it something like this:

//last in project source
if ParamStr(1) <> '' then
  Form1.AutoOpenFile(ParamStr(1));
  Application.Run;

//in main form unit
procedure TForm1.AutoOpenFile(const FileName: string);
begin
if FileExists(FileName) then
try
  //procedure for adding to recent files list
     AddFirstFileToMenu(TFileString(FileName)); //TFileString is mine
 //normal routine for opening a file
    Open_File(nil{sender}, FileName);
  except on EFOpenError do ShowMessage('Failed to open File: ' + FileName);
end;
end;

Open to critisism

Gordon.
~~~~~~~~~~~~~~~~~~~~~~~~
Certifiable - definitely <g>

http://members.aol.com/mgcsoft/  (the function junction equation editor)
http://members.aol.com/delphistuf/delphstf.htm   (Delphi bits and bobs and a
few links)

MGCSoft

Other Threads