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
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
openDialog : TOpenDialog; pdfDocument : array[0..255] of char;
begin
openDialog := TOpenDialog.Create(self);
openDialog.InitialDir := GetCurrentDir;
openDialog.Options := [ofFileMustExist];
openDialog.Filter := 'PDF Documents|*.pdf';
openDialog.FilterIndex := 1;
if openDialog.Execute then
begin
try
StrPCopy(pdfDocument,OpenDialog.FileName);
ShellExecute(Handle, 'open', pdfDocument, nil, nil, SW_SHOWNORMAL);
except
MessageDlg('Error en la Apertura del Documento PDF', mtInformation, [mbOk], 0);
end;
end;
openDialog.Free;
end;
end.