How can I Open PDF files (window default program Adobe Reader) through Delphi 2009?

adobe-reader, delphi, delphi-2009, pdf, shellexecute

Solution

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);

Problem

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!

Original source