Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Running a text file directly from a menu
Message
De
26/07/2004 05:56:11
 
 
À
21/07/2004 13:35:50
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00926569
Message ID:
00927854
Vues:
26
Hi Hilmar,

Just back from a few days holiday.
Thanks for your correspondence last week. I,ve made some progress.
I could load up my text files from the submenus using notepad.exe but still had problems with Wordpad.exe.

Since then My product development manager has decided that we should also allow images and excel documents to be picked up and run from the submenus. For Example depending on the type of file i.e report.xls, when selected should load Microsoft Excel and show this document.

Before When I was using only Notepad.exe, everthing was running fine. I would select the text file in the submenu and it loaded Notepad and showed the selected file.

Now after changing the code in my addmenu.prg and when I load the system, all the files open up one by one in Excel or Paint or Notepad etc, and after everyone is loaded I get a message ' Unregonised command verb'
Line 20 'On selection Bar i of keydoc &cCommand', I click Cancel and next one is loaded.

Attached below the code From my program.
I will appreciate any advice
Zaheed


*!* FUNCTION SHELLEXEC
*!* LPARAMETER lcLink, lcAction, lcParms, nWin

*!* vfp_handle = 0
*!* lcAction = IIF(EMPTY(lcAction),"Open",lcAction)
*!* lcParms = IIF(EMPTY(lcParms),"",lcParms)
*!* nShowWin = IIF(EMPTY(nWin),1,nWin)

*!* DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
*!* INTEGER nWinHandle, STRING cOperation, STRING cFilename, ;
*!* STRING cParameters, STRING cDirectory, INTEGER nShowWindow
*!*
*!* RETURN Shellexecute(vfp_handle,lcAction, lcLink, lcParms, SYS(2023),nShowWin)


USE AsbDoc AGAIN in 0 share
SELECT AsbDoc
GO top

SET near on
SET order to menu

SET procedure to utilities additive && Function Shellexec above put in Utilities.prg

DEFINE BAR 1 OF asbestosre PROMPT "\DEFINE BAR 2 OF asbestosre PROMPT "\DEFINE BAR 3 OF asbestosre PROMPT "\
ON BAR 2 OF asbestosre activate popup keydoc
ON BAR 3 OF asbestosre ACTIVATE POPUP oth

DEFINE POPUP keydoc && First one equal to 'D'
SEEK('D')
i=1
DO while(AsbDoc.ad_menu='D')
DEFINE BAR i of keydoc PROMPT (Allt(AsbDoc.ad_label))
cPath = Allt(AsbDoc.ad_file)
*cCommand = "run /N Notepad.exe "
cCommand = SHELLEXEC(cPath)
ON SELECTION BAR i of keydoc &cCommand
i=i+1
Skip
ENDDO

DEFINE POPUP oth
SEEK('O')
i=1
DO while(AsbDoc.ad_menu='O')
DEFINE BAR i of oth PROMPT (ALLT(AsbDoc.ad_label))
*comm=alltrim(AsbDoc.ad_command)
cPath = Allt(AsbDoc.ad_file)
cCommand = "run /N notepad.exe "
cRun = cCommand + cPath
ON SELECTION BAR i of oth &cRun
*!* ON SELECTION BAR i of oth &comm
i=i+1
Skip
ENDDO

SELECT AsbDoc
USE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform