So basically when I try to open up PDF files that are windows defaulted to open with Adobe Reader nothing happens. If I set the default program to Internet Explorer it works..
Here is my code
var
openDialog : TOpenDialog; // Open dialog variable
begin
openDialog := TOpenDialog.Create(self);
openDialog.InitialDir := MaskEditLocation.Text;
if openDialog.Execute then
ShellExecute(Handle, PChar('Open'), PChar(openDialog.FileName), nil, nil,
SW_SHOWNORMAL);
openDialog.Free;
end;
Any Ideas?
Thanks for the help!
You should never presume that the application has registered a specific verb like open
or run
. Just leave the verb empty when you want the default behavior, and let Windows decide:
ShellExecute(Handle, nil, PChar(OpenDialog.FileName), nil, nil, SW_SHOWNORMAL);