Open PDF files at a certain page

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Mar 2008
Posts: 42
Reputation: marcosjp is an unknown quantity at this point 
Solved Threads: 0
marcosjp marcosjp is offline Offline
Light Poster

Re: Open PDF files at a certain page

 
0
  #11
Feb 12th, 2009
Hi Prabakar,

What I've found out is GetDesktopWindow() works a bit different in Vista: it does not accept the directory info in the third parameter. So you have to indicate the directory in the fifth parameter. Kind of an ugly solution, as I will have to place the PDF files in the same directory where the reader exe is. Not good, but this is the only solution I could find for the moment.
Thanks very much for your help!!
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 334
Reputation: Prabakar is on a distinguished road 
Solved Threads: 29
Prabakar's Avatar
Prabakar Prabakar is offline Offline
Posting Whiz

Re: Open PDF files at a certain page

 
0
  #12
Feb 12th, 2009
Same directory as the reader? Why not give the full address fo the file?

Like this,

  1. ShellExecute(NULL, "open", "\"D:\\program files\\Adobe Reader 9.exe\"",
  2. "/A page=45 \"C:\\Documents and Settings\\Prabakar\\My Documents\\Downloads\\How to Do Everything _ Ubuntu (McGraw-Hill).pdf\"", NULL, SW_SHOWNORMAL);
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 122
Reputation: marco93 is infamous around these parts marco93 is infamous around these parts marco93 is infamous around these parts 
Solved Threads: 12
marco93 marco93 is offline Offline
Junior Poster

Re: Open PDF files at a certain page

 
0
  #13
Feb 14th, 2009
Originally Posted by Prabakar View Post
Same directory as the reader? Why not give the full address fo the file?
Paths must never be hard coded. You must get them from Shell.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 334
Reputation: Prabakar is on a distinguished road 
Solved Threads: 29
Prabakar's Avatar
Prabakar Prabakar is offline Offline
Posting Whiz

Re: Open PDF files at a certain page

 
0
  #14
Feb 14th, 2009
Originally Posted by marco93 View Post
Paths must never be hard coded. You must get them from Shell.
That's what I always do, but, it looked like the OP was not satisfied with it.

What if he can't move it from a particular folder? ( happens often when it is a shared computer)

Copying the pdf and pasting it on a specific directory just to make your program work is not a good option

And adding the program to that directory might be irritating. It will be annoying to see a document in my songs folder.

Sometimes we need to use full address, or at least to use environment variables.
Last edited by Prabakar; Feb 14th, 2009 at 5:45 am.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 2148 | Replies: 13
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC