Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to open a pdf file from VFP6.0?

Status
Not open for further replies.

rargi2002

Programmer
Mar 21, 2002
15
0
0
AR
Hello guys, please i have a problem because i do not know how to open a file with pdf extension from Visual Foxpro 6.0.
Any help will ber appreciated

thanks in advance

Ramon
 
The following will open a pdf file:

x=shellexec('file.pdf','c:\path\','Open','')

replace 'file.pdf with the actual pdf file and 'c:\path' with the actual path.

Some meanings of error values returned to x

2 ='File Open failed - Bad Association'
29='File Open failed - Failure to load Application'
30 ='File Open failed - Application is busy'
31 = 'File Open failed - The file you have tried to open has no Application Association'

 
mm0000

Based on my exprience your suggestion will not open a pdf file but rather will cause an error, as you have not declared the Shellexecute API.

rargi2002

For a more complete version of the ShellExecute API call take a look at faq184-3945.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Sorry in my haste i forgot to add the shellexec function

*** Pass: lcFileName - Name of the file to open
*** lcWorkDir - Working directory
*** lcOperation - "Open" "Run" "Play" "Edit" etc...
FUNCTION ShellExec
LPARAMETERS lcFileName, lcWorkDir, lcOperation, pcParameters
LOCAL pp, lcParam
pp = pCount()
if pp>3
lcParam = pcParameters
else
lcParam = ''
endif
lcWorkDir=IIF(type("lcWorkDir")="C",lcWorkDir,"")
lcOperation=IIF(type("lcOperation")="C",lcOperation,"Open")
DECLARE INTEGER ShellExecute ;
IN SHELL32.DLL ;
INTEGER nWinHandle,;
STRING cOperation,;
STRING cFileName,;
STRING cParameters,;
STRING cDirectory,;
INTEGER nShowWindow
RETURN ShellExecute(0,lcOperation,lcFilename,lcParam,lcWorkDir,1)


 
You might also want to take a look at thread184-609608

Steve Bowman
steve.bowman@ultraex.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top