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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing document/pdf file from menu pad..

Status
Not open for further replies.

MAliShah

Programmer
Nov 22, 2002
27
hi all,
I want to attach a document/pdf file as FAQ with my application. How can I access it from menu pad.
Thanks in Advance
 
Add the following code to a program and addd it to your menu pad. Repalce 'Filename' with the actual file name and 'Filedirectory' with the directory in which the file is located.


Code:
lnVal=shellexec('Filename','FileDirectory','Open','')

do case
   case lnVal = 2
        =messagebox('File Open failed - Bad Association',16,'Error Message')
   case lnVal = 29
        =messagebox('File Open failed - Failure to load Application',16,'Error Message')
   case lnVal = 30
        =messagebox('File Open failed - Application is busy',16,'Error Message')
   case lnVal = 31
        =messagebox('File Open failed - The file you have tried to open has no Application Association',16,'Error Message')
endcase 

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)
*ENDFUNC  ShellExecute

 
Thanks. The code worked. A big star for u
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top