| | |
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 api array arrays binarysearch calculate char cm copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators initialization iso kernel kilometer km linked linkedlist linux linuxsegmentationfault list lists locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue multi mysql odf open opensource openwebfoundation owf pattern pdf performance pointer pointers posix power probleminc program programming pyramidusingturboccodes read recursion recv repetition research scanf scheduling scripting segmentationfault send shape socketprograming socketprogramming stack standard string strings suggestions systemcall test testautomation unix urboc user voidmain() wab win32api windows.h






