Registriert seit: 8. Feb 2005
51 Beiträge
Delphi 2009 Professional
|
Re: Hostanwendung für gegebenen Dateityp bestimmen
15. Jun 2008, 22:05
Könnte damit klappen
Delphi-Quellcode:
function FindExecutableA(lpFile: PChar; lpDirectory: PChar; lpResult: PChar): Cardinal; stdcall; external 'shell32.dll' name 'FindExecutableA';
function GetExeFromDocument(const Document: String; const Directory: String): String;
var
ret: array[0..MAX_PATH-1] of char;
lpFile,
lpDirectory: PChar;
begin
result:= '';
ZeroMemory(@ret, MAX_PATH);
lpFile:= PChar(Document);
lpDirectory:= PChar(Directory);
if FindExecutableA(lpFile, lpDirectory, @ret[0]) > 32 then
Result:= ret;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Showmessage(GetExeFromDocument('a.txt', 'D:\Temp'));
end;
|
|
Zitat
|