| | |
Opening PDF files
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Mar 2008
Posts: 42
Reputation:
Solved Threads: 0
Hello there!
I need to open PDF files from a C program. So, initially I have this solution:
However, this code has its limitations:
1. It works, but a shell window comes up and closes when opening the PDF file. Is there a way to avoid this? Maybe using another programming language?
2. This is Windows specific - I'd like to be able to do it in Linux as well.
3. What is the advantage of using this to using this one?
Thanks very much for any help!
[]s
Marcos
I need to open PDF files from a C program. So, initially I have this solution:
c Syntax (Toggle Plain Text)
ShellExecute(GetDesktopWindow(), "open", "c:\somefolder\myFile.pdf", NULL, NULL, SW_SHOWNORMAL);
However, this code has its limitations:
1. It works, but a shell window comes up and closes when opening the PDF file. Is there a way to avoid this? Maybe using another programming language?
2. This is Windows specific - I'd like to be able to do it in Linux as well.
3. What is the advantage of using this to using this one?
c Syntax (Toggle Plain Text)
system("start c:\\somefolder\\myFile.pdf");
Thanks very much for any help!
[]s
Marcos
•
•
Join Date: Mar 2008
Posts: 42
Reputation:
Solved Threads: 0
•
•
•
•
1. It DOES NOT work because you forgot to double backslashes in the file name string literal (see point #3 example in your snippet).
I will ask this in a different way. Forget Windows. How do I get the same results in a) Linux and b) Mac?
And the first question, how to avoid the shell window, is actually the most important right now. I know there is a solution,... Any hints?

Thanks
[]s
Marcos
![]() |
Similar Threads
- creating pdf files (ASP.NET)
- opening PDF file with streamreader in vb.net (VB.NET)
- Converting PDF files to word document !!! Plz Help (Visual Basic 4 / 5 / 6)
- pdf files not opening - help for strange problem (Windows NT / 2000 / XP)
- Adobe Acrobat 6.0 - not opening (Windows NT / 2000 / XP)
- Adobe 6.0 (Windows Software)
Other Threads in the C Forum
- Previous Thread: Correction
- Next Thread: Function to grab User/Password combinations from a file
| Thread Tools | Search this Thread |
#include * ansi array arrays asterisks bash binarysearch calculate centimeter changingto char character convert copyanyfile copyimagefile creafecopyofanytypeoffileinc createprocess() database dynamic execv fgets file floatingpointvalidation fork framework function getlogicaldrivestrin givemetehcodez grade gtkwinlinux histogram ide inches include infiniteloop initialization input interest intmain() iso keyboard km license linked linkedlist linux list looping lowest matrix meter microsoft number oddnumber open opendocumentformat openwebfoundation owf pdf pointer pointers posix power probleminc process program programming pyramidusingturboccodes radix read recursion recv recvblocked research reversing scheduling segmentationfault send sequential single socket socketprogramming standard strchr string suggestions systemcall test testautomation testing threads turboc unix urboc user variable whythiscodecausesegmentationfault win32api windowsapi






