Call Adobe reader from C#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In a c# program, how would you get the default program associated with the
".PDF" extensions and then get that program to execuete the program using the
PDF file?

Thanks in advance

bob
 
Robert,

You could probably read the registry, get the program, find the way to
pass it to the command line, or use the API to get this information.

However, if you don't need to know the details, and just need to get it
done, your best bet would be to just pass the full path of the file to the
Process class, and make sure the UseShellExtension property is set to true
on the ProcessStartInfo class instance you pass to Start (or the Process
class itself).

Hope this helps.
 
Nicholas said:
However, if you don't need to know the details, and just need to
get it done, your best bet would be to just pass the full path of the
file to the Process class, and make sure the UseShellExtension
property is set to true on the ProcessStartInfo class instance you
pass to Start (or the Process class itself).

That would be the ProcessStartInfo.UseShellExecute property, not
..UseShellExtension (unless they've added new stuff in builds of Whidbey I
don't have access to.)


--
Arild

AnkhSVN - Subverting Visual Studio .NET: http://ankhsvn.tigris.org
Blog: http://ankhsvn.com/blog
IRC: irc://irc.freenode.net/ankhsvn

"Gentlemen, you can't fight in here! This is the war room!"
 
Back
Top