INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

API Functions

How can I ensure ShellExecute() will print a pdf in windows 10? by ChrisRChamberlain
Posted: 7 Sep 16 (Edited 8 Sep 16)

If you are running VFP on Windows 10, one of the 'gotchas' of which to be wary, is Windows 10 resetting the default applications for various file extensions.

The default application for pdf in Windows 10 is Microsoft Edge so if you use the 'print' parameter with the WinAPI call ShellExecute() with that file association in place, the pdf will not print.

The return value from ShellExecute() will be 31, API_ERROR() returning the string "The file type has no associated application" for that value.

One option is to block Window 10's attempts to reset the default applications for the pdf file extension.

First ensure pdfs will print correctly from your chosen pdf viewer/application when set as the default application in Windows 10.

Then, in regedit.exe, navigate to:-

CODE -->

HKEY_CURRENT_USER\SOFTWARE\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723 

Add create a new string value here named NoOpenWith and don't set its value data (leave it empty):-

CODE

NoOpenWith="" 

It's all neatly explained here, together with original code and other options.

So, from now on, Windows 10 resetting behaviour should not impact on your VFP apps.

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close