Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Adobe reader can't open pdf file from shellexecute

Posted on 2007-11-29
6
Medium Priority
?
2,960 Views
Last Modified: 2010-04-21
I use a shellexecute command to open a pdf document from a delphi app. After upgrading Adobe Reader to 8.1.1 it no longer works and I get the error message:

There was an error opening this document. The file cannot be found.

The file can be opened from within Adobe Reader without any problems. It worked fine before 8.1.1.

Andy help would be appreciated. Thanks

Open in new window

0
Comment
Question by:Link-HRSystems
  • 3
  • 2
6 Comments
 
LVL 21

Expert Comment

by:ziolko
ID: 20374436
any code sample would be appreciated

ziolko.
0
 

Author Comment

by:Link-HRSystems
ID: 20374494
Here you go if it helps.

Thanks
filename := ExtractFilePath(Application.ExeName)+ 'Documentation\'+ pdffile;
 
sExecutable := ShellFindExecutable(filename,ExtractFilePath(filename));
 
ShellExecute(hInstance, nil, PChar(sExecutable), pChar(filename), nil,
        SW_SHOW);

Open in new window

0
 
LVL 18

Expert Comment

by:Johnjces
ID: 20375450
Would you please try

if shellexecute(handle, nil, Pchar(filename), nil, nil, SW_SHOW) < 32 then
    ShowMessage('Unable to open file');

As long as the .pdf extension is properly registered, (or any other extension) this should open Adobe and the file so there is no need of specifying the executable.

Therfor filename has to be the complete path filename and .pdf extension.

John
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 21

Accepted Solution

by:
ziolko earned 500 total points
ID: 20380395
first of check if ShellFindExecutable() returns correct path
then try this:
ShellExecute(hInstance, 'open', PChar(sExecutable), pChar(filename), nil,  SW_SHOW);
or
ShellExecute(hInstance, 'open', nil, pChar(filename), nil,  SW_SHOW);

ziolko.
0
 

Author Comment

by:Link-HRSystems
ID: 20380951
Thanks for the replies.

John
I can open the file using just the filename but I need to specify page number as well, that is why I was using Parameters.

Does anyone have the syntax to specify a page number as well?

Thanks
0
 

Author Closing Comment

by:Link-HRSystems
ID: 31411686
This did answer my question wasn't my full issue, my mistake I will post another question.

Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Screencast - Getting to Know the Pipeline
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question