To get full path to application associated with any file type, we need standard
ShellAPI
unit and the rest will do the FindExecutable
function.
This function retrieves the name of and handle to the executable (.exe)
file associated with a specific document file. For more information,
visit detailed description on MSDN.
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ShellAPI; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var app: PChar; begin GetMem(app, 255); FindExecutable('test.txt', 'c:\', app); Application.MessageBox(App, 'Associated application', mb_ok +
mb_iconinformation); end; end.
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου