| | |
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 |
* ansi api append array arrays bash binarysearch calculate centimeter changingto char character convert copyanyfile copypdffile creafecopyofanytypeoffileinc createcopyoffile createprocess() dynamic execv fflush file floatingpointvalidation fork forloop frequency function getlogicaldrivestrin givemetehcodez grade graphics gtkwinlinux histogram homework i/o ide inches include infiniteloop initialization input intmain() iso keyboard km license linked linkedlist linux list looping loopinsideloop. lowest matrix microsoft multi mysql oddnumber open opendocumentformat openwebfoundation overwrite pdf pointer pointers posix power program programming pyramidusingturboccodes radix read recursion recv recvblocked reversing scanf scheduling segmentationfault send shape single socketprogramming stack standard strchr string strings suggestions test testautomation threads unix urboc user variable whythiscodecausesegmentationfault win32api windowsapi






