Opening a PDF file w/o opening acrobat first 
Author Message
 Opening a PDF file w/o opening acrobat first

I wanna have a button that will open a file using the directly not have to
open acrobat then open the pdf file...i know the shell command will open the
program then the file but that wont work because the install directory for
all the Acrobat programs is different...how can i open this file then


Wed, 27 Feb 2002 03:00:00 GMT  
 Opening a PDF file w/o opening acrobat first
Search Web on ShellExecute
Neila

Quote:

>I wanna have a button that will open a file using the directly not have to
>open acrobat then open the pdf file...i know the shell command will open
the
>program then the file but that wont work because the install directory for
>all the Acrobat programs is different...how can i open this file then



Wed, 27 Feb 2002 03:00:00 GMT  
 Opening a PDF file w/o opening acrobat first
You had said to make sure the function declaration is setup correctly....i
dont know what you mean....i am a rookie at all of this stuff so if you
could help me out i would appreciate it


Quote:
> righty well I'd probably use the shellexecute function.......

> like this.....

> Private Declare Function ShellExecute Lib "shell32.dll" Alias
> "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal
> lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As
String,
> ByVal nShowCmd As Long) As Long
> Const SW_SHOWNORMAL = 1

> hstartup = ShellExecute(Form1.hWnd, "open", "yourfile.pdf", "", "",
> SW_SHOWNORMAL)

> ..so if acrobat is installed on a computer [correctly] then the above will
> open the file direct...
> (if u gonna use the code above then make sure the function declaration is
> set out correctly :)

> cu
> ric


> >I wanna have a button that will open a file using the directly not have
to
> >open acrobat then open the pdf file...i know the shell command will open
> the
> >program then the file but that wont work because the install directory
for
> >all the Acrobat programs is different...how can i open this file then



Wed, 27 Feb 2002 03:00:00 GMT  
 Opening a PDF file w/o opening acrobat first
It shouldn't matter where Acrobat was installed to.  The system knows.  If
you use the ShellExecute API function rather than the VB Shell function, it
will automatically start Acrobat based on the systems file type registration
information.

You could try using the Acrobat ocx control if you want real integration in
VB.  It's included with the Acrobat reader and should show up in your
Project/Controls...  menu option.  I *think* it's distributable, but you'll
have to check with Adobe to be sure.

Jon Brierley
Engineering Software Developer
Armtec


Quote:
> I wanna have a button that will open a file using the directly not have to
> open acrobat then open the pdf file...i know the shell command will open
the
> program then the file but that wont work because the install directory for
> all the Acrobat programs is different...how can i open this file then



Wed, 27 Feb 2002 03:00:00 GMT  
 Opening a PDF file w/o opening acrobat first
righty well I'd probably use the shellexecute function.......

like this.....

Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String,
ByVal nShowCmd As Long) As Long
Const SW_SHOWNORMAL = 1

hstartup = ShellExecute(Form1.hWnd, "open", "yourfile.pdf", "", "",
SW_SHOWNORMAL)

..so if acrobat is installed on a computer [correctly] then the above will
open the file direct...
(if u gonna use the code above then make sure the function declaration is
set out correctly :)

cu
ric

Quote:

>I wanna have a button that will open a file using the directly not have to
>open acrobat then open the pdf file...i know the shell command will open
the
>program then the file but that wont work because the install directory for
>all the Acrobat programs is different...how can i open this file then



Thu, 28 Feb 2002 03:00:00 GMT  
 Opening a PDF file w/o opening acrobat first
Ok, in the General Declarations section of your form, declare the API
function and the constants used.  I'm assuming here that it's being done
from a form:

Private Const SW_SHOW = 5

Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String,
ByVal nShowCmd As Long) As Long

In your Button_Click event, use this code:

If ShellExecute(me.hwnd, "open" & chr(0), App.Path & "\PDFFILENAME.PDF" &
chr(0), 0&, App.Path & chr(0), SW_SHOW) <= 32 then

        Msgbox "Unable to launch adobe Acrobat"

End If

HOWEVER.  You say this is going to be autorun from a CD.  You are aware that
this won't work on any machine that doesn't already have the VB support
files, aren't you?  Typically you have the use the Package and Deployment
Wizard to create a setup application for all VB apps.

Regards,

Jon Brierley

Quote:
----- Original Message -----


Sent: September 12, 1999 5:23 PM
Subject: Re: Opening a PDF file w/o opening acrobat first

> Jon,
> I am just getting into this VB programing field therefore im a rookie.
> Im not too familar on how to do the ShellExecute function... Someone gave
me
> some code in the newsgroup but i cant get it working...i have tried
> everything.

> All i want to do is have the file opened, i dont need any integration or
> anything. I just want it to open the file in Acrobats Window and not in
> another form window in the VB program.  This App that im making is a
Autorun
> file and i have buttons. I want to click on the button and have it  launch
> this pdf file....

> If you could give me some VB code or send me to some place that can show
me
> how to do this better i would be so greatful.

> Thank you,
> Ryan


> > It shouldn't matter where Acrobat was installed to.  The system knows.
If
> > you use the ShellExecute API function rather than the VB Shell function,
> it
> > will automatically start Acrobat based on the systems file type
> registration
> > information.

> > You could try using the Acrobat ocx control if you want real integration
> in
> > VB.  It's included with the Acrobat reader and should show up in your
> > Project/Controls...  menu option.  I *think* it's distributable, but
> you'll
> > have to check with Adobe to be sure.

> > Jon Brierley
> > Engineering Software Developer
> > Armtec



> > > I wanna have a button that will open a file using the directly not
have
> to
> > > open acrobat then open the pdf file...i know the shell command will
open
> > the
> > > program then the file but that wont work because the install directory
> for
> > > all the Acrobat programs is different...how can i open this file then



Thu, 28 Feb 2002 03:00:00 GMT  
 Opening a PDF file w/o opening acrobat first
I cant get the code to launch the acrobat file


Quote:
> Ok, in the General Declarations section of your form, declare the API
> function and the constants used.  I'm assuming here that it's being done
> from a form:

> Private Const SW_SHOW = 5

> Private Declare Function ShellExecute Lib "shell32.dll" Alias
> "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal
> lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As
String,
> ByVal nShowCmd As Long) As Long

> In your Button_Click event, use this code:

> If ShellExecute(me.hwnd, "open" & chr(0), App.Path & "\PDFFILENAME.PDF" &
> chr(0), 0&, App.Path & chr(0), SW_SHOW) <= 32 then

>         Msgbox "Unable to launch adobe Acrobat"

> End If

> HOWEVER.  You say this is going to be autorun from a CD.  You are aware
that
> this won't work on any machine that doesn't already have the VB support
> files, aren't you?  Typically you have the use the Package and Deployment
> Wizard to create a setup application for all VB apps.

> Regards,

> Jon Brierley

> ----- Original Message -----


> Sent: September 12, 1999 5:23 PM
> Subject: Re: Opening a PDF file w/o opening acrobat first

> > Jon,
> > I am just getting into this VB programing field therefore im a rookie.
> > Im not too familar on how to do the ShellExecute function... Someone
gave
> me
> > some code in the newsgroup but i cant get it working...i have tried
> > everything.

> > All i want to do is have the file opened, i dont need any integration or
> > anything. I just want it to open the file in Acrobats Window and not in
> > another form window in the VB program.  This App that im making is a
> Autorun
> > file and i have buttons. I want to click on the button and have it
launch
> > this pdf file....

> > If you could give me some VB code or send me to some place that can show
> me
> > how to do this better i would be so greatful.

> > Thank you,
> > Ryan


> > > It shouldn't matter where Acrobat was installed to.  The system knows.
> If
> > > you use the ShellExecute API function rather than the VB Shell
function,
> > it
> > > will automatically start Acrobat based on the systems file type
> > registration
> > > information.

> > > You could try using the Acrobat ocx control if you want real
integration
> > in
> > > VB.  It's included with the Acrobat reader and should show up in your
> > > Project/Controls...  menu option.  I *think* it's distributable, but
> > you'll
> > > have to check with Adobe to be sure.

> > > Jon Brierley
> > > Engineering Software Developer
> > > Armtec



> > > > I wanna have a button that will open a file using the directly not
> have
> > to
> > > > open acrobat then open the pdf file...i know the shell command will
> open
> > > the
> > > > program then the file but that wont work because the install
directory
> > for
> > > > all the Acrobat programs is different...how can i open this file
then



Fri, 01 Mar 2002 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Opening a .pdf file using Acrobat Reader from VB

2. How to print open email to Adobe Acrobat PDF format

3. opening PDF in acrobat instead of explorer...

4. opening an Adobe Acrobat file

5. Opening Adobe Acrobat files

6. Launching Acrobat Reader and Opening File ?

7. Acrobat PDF Files -> Help File convertion

8. Open and Read a PDF file

9. How do I open a PDF from a file using access

10. Open a PDF File

11. Opening PDF file from Access

12. CommandButton to open a TIF or PDF file?

 

 
Powered by phpBB® Forum Software