Jon Cage
Jon Cage

Reputation: 37500

How do I launch a .pdf programmatically?

I have a .pdf help file and would like to launch it from my C++/CLI application.

Currently I do the following:

System::Diagnostics::Process::Start("iexplore", "C:\\MyPdf.pdf");

...which works but has the irritating side effect of opening it in internet explorer. Is there a way to launch it in whatever the Windows currently uses to open .pdf files?

Upvotes: 0

Views: 1477

Answers (2)

Aravind
Aravind

Reputation: 1130

When starting a process without specifying the application to open that file, it will be opened by the default application.

Anyway, if you configure your system to associate the pdf files by PDF file reader applications, then it will be automatically started by the PDF reader application.

You can cross check it by running "start filename.pdf" command in command line.

Upvotes: 0

DenisPostu
DenisPostu

Reputation: 599

This will let the system decide which viewer to use..

 System::Diagnostics::Process::Start("C:\\MyPdf.pdf");

Upvotes: 4

Related Questions