Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ShellExecute won't open PDFs

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
0
0
GB
I've written some code for opening a file when it's double-clicked. It works fine on my machine for every type of file, but on one machine in the office it refuses to open PDF files. We've installed Acrobat 7 afresh, and it will open PDF files from Explorer when you double-click them, and all other types of files open when they are double-clicked in my app, except for PDFs.

Is there any reason why PDFs won't open in VB just on one machine?

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
how are you calling the file exe?
i had a similar problem with adobe and all i needed to do was open adobe to get past the lisense agreement then it was ok.
this by the sound of things is not the case but it is worth a try.
The other idea i have is the paths and associations in the registers are you getting the paths in the vb from the association area in the reg or are you using a shell thing?
 
I'm using the same API call regardless of what type of file is double-clicked;

ShellExecute 0&, "Open", F$, "", "", SW_ShowMaximized

where F$ is the file to be opened. Like I say this approach works fine with PDF files on other machines, it's just one machine that refuses to work. In that sense it's not really a VB question I suppose, I just hoped someone might have a suggestion.

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Have you tried specifying a directory rather than a null string?

I've had problems in the past with PDFs and specifying a path has fixed it. You could also check the result returned by ShellExecute as this normaly tells you why it's failed.

These are the errors I usually check for.

Const SE_ERR_FNF = 2&
Const SE_ERR_PNF = 3&
Const SE_ERR_ACCESSDENIED = 5&
Const SE_ERR_OOM = 8&
Const SE_ERR_DLLNOTFOUND = 32&
Const SE_ERR_SHARE = 26&
Const SE_ERR_ASSOCINCOMPLETE = 27&
Const SE_ERR_DDETIMEOUT = 28&
Const SE_ERR_DDEFAIL = 29&
Const SE_ERR_DDEBUSY = 30&
Const SE_ERR_NOASSOC = 31&
Const ERROR_BAD_FORMAT = 11&

- Sindo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top