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!

How can I ensure ShellExecute() will print a pdf in windows 10? 1

Status
Not open for further replies.
Very useful, Chris. Thanks for sharing it. I didn't know that Edge is the default PDF viewer in Windows 10. Presumably, the "print" parameter doesn't work with Edge, which is why we need your workaround.

I suppose another solution would be to use ShellExecute() to directly execute the PDF viewer, passing the document name as the fourth parameter. For example:

Code:
ShellExecute("0, "print", "<path>\MyPDFViewer.exe", "<path>\MyFile.pdf", "", 1)

Of course, that assumes you know the name and path of the PEF viewer installed on the user's system, which might rule it out in many cases.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike

Have recently been 'bitten' by this, hence the FAQ.

I have gone with simplest is best and am sure, as you have shown, there may be other alternatives to consider.


FAQ184-2483​
Chris [pc2]
motrac.co.uk
 
I suppose you could make your app drop a specific PDF viewer into the same folder as the executable is run from each time it is loaded - there are probably freeware ones available

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top