Thanks Kevin.
I'll try it out.
>Hi Dean,
>Here is code I picked up on the UT some time ago. Basically it will run the registered program dependant on the file type. I found it works perfectly. Just make sure Adobe Acrobat Reader is installed correctly.
>
>
>********************************************************************
>* Description.......: RunDoc - opens any document
>* Calling Samples...:
>* Parameter List....: tcDocument
>* Created by........: Hilmar Zonneveld November 8, 2001 10:43
>* Modified by.......:
>********************************************************************
>* Sample use:
>* MyFile = "Document.pdf"
>* RunDoc(MyFile)
>
>FUNCTION RunDoc(tcDocument)
> if vartype(m.tcDocument)<>"C" or !file(m.tcDocument)
> return .f. && Invalid parameter
> endif
> local lnResult
>
> DECLARE INTEGER ShellExecute ;
> IN SHELL32.dll ;
> INTEGER nWinHandle, ;
> STRING cOperation, ;
> STRING cFileName, ;
> STRING cParameters, ;
> STRING cDirectory, ;
> INTEGER nShowWindow
>
> **retreive the main VFP window handle (this handle is used by ShellExecute)
>
> DECLARE INTEGER FindWindow ;
> IN WIN32API ;
> STRING cNull, ;
> STRING cWinName
>
> lnResult=ShellExecute(FindWindow( 0, _SCREEN.caption), "Open", tcDocument, "", sys(2023)+'\', 1)
>
> **Error messages if the return value is < 32
> IF m.lnResult < 32
> DO CASE
> CASE m.lnResult=2
> Wait wind "Invalid association or URL."
> CASE m.lnResult=31
> Wait wind "No association."
> CASE m.lnResult=29
> Wait wind "Can't start application."
> CASE m.lnResult=30
> Wait wind "Application is already open."
> ENDCASE
> ENDIF
> return m.lnResult>=32
>ENDFUNC
Work as if you don't need money
Love as if you've never been hurt before
Live as if this is your last day to live
Dance as if no one's watching