| | |
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 |
adobe ansi api array arrays asterisks bash binarysearch calculate centimeter char convert copyanyfile copyimagefile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic fflush file fork frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators infiniteloop initialization interest km linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix meter microsoft motherboard multi mysql number open opendocumentformat opensource owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling scripting segmentationfault send shape socketprograming stack standard string strings structures suggestions system systemcall test testautomation unix user variable voidmain() wab win32api windows.h






