|
-
May 16th, 2007, 05:42 AM
#1
Thread Starter
Fanatic Member
Acrobat Files - Open/Close?
I have installed Acrobat on my device and then placed some acrobat files which I intend to use as help files in my program files directory of the device.
Now I want to display one of the 3 files if certain conditions exist so I thought simple enough use an if then else statement and display the correct file for the conditions.
File.Open("\program files\ax3\help1")
Does not work, so what is the correct syntax please
Also how do you close the other files that are not being displayed rather than leaving them running and using up resources
-
May 16th, 2007, 06:35 AM
#2
Frenzied Member
Re: Acrobat Files - Open/Close?
Hi,
you will need to run the acrobat reader using 'process.start' and send it the name of the file as a command line parameter I think.
Pete
-
May 16th, 2007, 09:00 AM
#3
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete, thanks as ever for your help:
Well I am making progress I think
this is now the code
Code:
File.Open("\program files\ax3\help1")Process.Start("\Program Files\Adobe\Acrobat 2.0\Reader\acroRD32.exe ", "\My Documents\help1")
And it now generates this error when MenuItem2 is clicked
ErrorCode=-2147467259
Message="Win32Exception"
StackTrace:
at System.Diagnostics.Process.StartWithShellExecuteEx()
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start()
at M2_5.Form1.MenuItem2_Click_1()
at System.Windows.Forms.MenuItem.OnClick()
at System.Windows.Forms.Menu.ProcessMnuProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at M2_5.Form1.Main()
Any thoughts?
-
May 16th, 2007, 10:51 AM
#4
Frenzied Member
Re: Acrobat Files - Open/Close?
Hi,
drop the file.open - you just need the process.start
Pete
-
May 16th, 2007, 06:21 PM
#5
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete
Thanks again,
The code now is
Code:
Process.Start("\Program Files\Adobe\Acrobat 2.0\Reader\acroRD32.exe", "\My Documents\help1.pdf")
This opens Acrobat Reader but then fails with an error message saying file not found.
The file is definatly at the location and is named as in the code, but reader for some reason does not find it
-
May 17th, 2007, 10:03 AM
#6
Frenzied Member
Re: Acrobat Files - Open/Close?
Hi,
I am assuming you can send it a parameter of the file to open, but I don't know as I have never used Acrobat on the PPC.
What about trying
Process.Start( "\My Documents\help1.pdf")
It may work like shell
Pete
-
May 17th, 2007, 01:28 PM
#7
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete
No tried that one sometime ago, it fires an error:
Value of type 'String' cannot be converted to 'System.Diagnostics.ProcessStartInfo'.
This explains it
http://msdn2.microsoft.com/en-us/lib...t5(VS.80).aspx
But it only seems to confirm what I am doing should work
Last edited by JohnSavage; May 17th, 2007 at 01:39 PM.
-
May 18th, 2007, 01:27 AM
#8
Frenzied Member
Re: Acrobat Files - Open/Close?
OK,
try and run the command manually and see what happens. To get to the run command, go to the today screen, hold down the action button, and then, depending on the OS tap and hold the time (PPC 2003) or tap and hold the battery icon (WM5), then release the button. This should show a popup menu with Clock and Run. Click on Run and the run command box appears.(http://www.pocketpcdn.com/articles/run.html)
You can then type or paste in your command line from process start, and see what happens, as this should do the sames as process.start
HTH
Pete
-
May 18th, 2007, 05:01 AM
#9
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete
Thanks again, this time real progress:
Using your method I appear to have some sort of a path issue. Let me explain, if I copy the help file to the root and then use the run command “\help1.pdf” it opens OK.
If I type in \My Documents\help1.pdf (with a copy of the file in that location)then I get “Cannot find ‘My’ or one of its components. Make sure the path and filename are correct and all the required libraries are available
If I type in \MyDocuments\help1.pdf then, Reader opens and then stops with the error message “There was an error opening this document. The path does not exist. Which is I suppose correct
-
May 18th, 2007, 07:23 AM
#10
Frenzied Member
Re: Acrobat Files - Open/Close?
What about trying
"\My Documents\help1.pdf"
complete with quotes - does that help?
Pete
-
May 18th, 2007, 08:37 AM
#11
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete
YES that works, but forgive me what has this achieved?
-
May 18th, 2007, 09:27 AM
#12
Frenzied Member
Re: Acrobat Files - Open/Close?
that if you so a process.start with
chr(34) & \My Documents\help1.pdf & chr(34) that may work,
or
Process.Start("\Program Files\Adobe\Acrobat 2.0\Reader\acroRD32.exe", chr(34) & "\My Documents\help1.pdf" & chr(34))
Pete
-
May 18th, 2007, 10:43 AM
#13
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete,
The line of code
Code:
Process.Start("\Program Files\Adobe\Acrobat 2.0\Reader\acroRD32.exe", chr(34) & "\My Documents\help1.pdf" & chr(34))
Causes A.Reader to run and then close going back to my app with no errors reported, but it never displays the file. When I close the app A.Reader is not running in the background
-
May 18th, 2007, 10:49 AM
#14
Frenzied Member
Re: Acrobat Files - Open/Close?
What does
Process.Start(chr(34) & "\My Documents\help1.pdf" & chr(34))
do?
-
May 18th, 2007, 01:46 PM
#15
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete
It gets me an error that says
Value of type 'String' cannot be converted to 'System.Diagnostics.ProcessStartInfo'
-
May 20th, 2007, 03:01 AM
#16
Frenzied Member
Re: Acrobat Files - Open/Close?
OK,
process.start("My Documents\help1.pdf,"")
should do it, provided pdf is associated with adobe reader.
if you do
process.start("\Windows\infbeg.wav") it should play the wave file, as .wav is associated with sound player
Pete
-
May 20th, 2007, 04:23 AM
#17
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Good Morning Pete,
Code:
process.start("My Documents\help1.pdf,"")
That gets two errors
Error 1 String constants must end with a double quote.
Error 2 Value of type 'String' cannot be converted to 'System.Diagnostics.ProcessStartInfo'.
On the file association issue, I think it is associated as the file has an acrobat icon. Having gone through the active sync process to get into my device.
Last edited by JohnSavage; May 20th, 2007 at 06:33 AM.
-
May 20th, 2007, 08:35 AM
#18
Frenzied Member
Re: Acrobat Files - Open/Close?
Hi,
sorry - mistyped it 
Should be
process.start("My Documents\help1.pdf","")
or
process.start("\windows\infbeg.wav","")
Pete
-
May 20th, 2007, 10:02 AM
#19
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete,
process.start("My Documents\help1.pdf","")
or
process.start("\My Documents\help1.pdf","")
Both cause Acrobat Reader to run (splash screen shows) and then help1.pdf is displayed at the top of the screen in the Start position and then it closes and goes back to my application. With no errors reported.
When I later check if Acrobat is running in memory it is not.
It appears that it opens the file and then immediately closes it and the Acrobat Reader application.
-
May 20th, 2007, 11:30 AM
#20
Frenzied Member
Re: Acrobat Files - Open/Close?
Hi,
there are other ways to process.start - if you check, you can wait until the application you started terminates.
Dim wordProc As Process = Process.Start("\My Documents\help1.pdf", "")
wordProc.WaitForExit()
Pete
Last edited by petevick; May 20th, 2007 at 12:26 PM.
-
May 20th, 2007, 01:23 PM
#21
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete
I am not to sure I understand what you are saying.
This file help1.pdf is just one of 3 help files I intended to use with this app, I am trying to let the user press help while using the app and then hopefully after reading the file go back to using the app. As I said earlier in this thread the intension is to use these help files in a context sensitive way using an if, then else statement.
-
May 21st, 2007, 01:12 AM
#22
Frenzied Member
Re: Acrobat Files - Open/Close?
Hi,
it should keep it running until you close it, unless it is an acrobat thing. Frankly, for help files, I would stick with HTML, they are more lightweight than acrobat. I use the excellent FastHelp for creating help files - creates PPC format plus web, pdf, word, chm and hlp
Pete
-
May 21st, 2007, 04:11 AM
#23
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete
The reason I was going for Acrobat is I want to use pictures in the help file can this be done with HTML format?
-
May 21st, 2007, 05:04 AM
#24
Frenzied Member
Re: Acrobat Files - Open/Close?
Hi,
yep - sure can.
I did a review of fasthelp here and I am pretty sure MSDN has some step by step examples
Pete
-
May 21st, 2007, 07:09 AM
#25
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete,
Fast Help is a little too rich for me.
I have saved a word file as an HTML file and on the desktop the picture are lost and are replaced with an empty box with a red X in the top left.
If I save the word file as an MHTML file then the pictures are OK, but if I then move it to my device and use the code
Code:
Process.Start("\Program Files\Max3\help1.mhtml", "")
To open it I get the message that there is no application assoiated with this file
-
May 21st, 2007, 07:42 AM
#26
Frenzied Member
Re: Acrobat Files - Open/Close?
-
May 21st, 2007, 08:10 AM
#27
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete,
I have looked at these Help systems but it appears that Pocket PC likes to have all the help files separate from the applications so the user can either use the application or go look at the help file.
This is not what I am trying to create I want an application that has context sensitive help integrated with it. Which is why I have been taking up your time to date (sorry).
If I can simply display a file when I want to as a result of the user pressing a button in my application then I can control which file is displayed.
In the past I have used Acrobat files to great effect in this way Acrobat also gave me the ability to stop the user printing the help files which again suited my purposes in some cases but as we have found it appears not to easy too get it to work on the Pocket Platform.
So at your suggestion we have moved to HTML format files which again appear to do the job but will not display a picture the mhtml appears to display a picture but is not associated with pocket internet explorer and therefore I cannot use it.
-
May 21st, 2007, 08:26 AM
#28
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete,
I have just tried
Process.Start("\Windows\iexplore.exe", "\Program Files\Max3\ICE.mhtml")
And it appears that Pocket Internet Exployer will not open this file type but the desktop version does. So I am left with html format but as I said when I save this file as an html I get no pictures as these are replaced by empty boxes with a red “X” in the top left corner can I fix this or is it not posible?
-
May 21st, 2007, 11:37 AM
#29
Frenzied Member
Re: Acrobat Files - Open/Close?
Hi,
just use HTML files - not mhtml, as you can embed pictures in them. The pictures need to be in the windows folder, as does the html file.
Pete
-
May 21st, 2007, 01:57 PM
#30
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete,
Ok thanks for all of your time amd effort to date, I will leave this thread open if you don't mind as I would really like to know why the Acrobat solution does not work.
-
May 23rd, 2007, 06:41 AM
#31
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Pete,
I have just found something that’s real strange.
I have installed my application on my phone and now the PDF’s work with no problems at all using the code below
Code:
If Label44.Visible = True Then
Process.Start("\My Documents\Help1.pdf", "")
ElseIf Label47.Visible = True Then
Process.Start("\My Documents\Help2.pdf", "")
Else
Process.Start("\My Documents\Help3.pdf", "")
End If
But and here’s the catch, my phone does not have acrobat installed, but does have Clear Vue PDF installed. So it would appear that a third party software package in this case works when the original does not
-
May 23rd, 2007, 07:54 AM
#32
Frenzied Member
Re: Acrobat Files - Open/Close?
Hi,
glad it is working - I will refrain from making any disparaging remarks about Acrobat Reader on a PDA 
Pete
-
May 23rd, 2007, 08:19 AM
#33
Thread Starter
Fanatic Member
Re: Acrobat Files - Open/Close?
Cheers Pete, however it looks like your remarks would be justified in this case
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|