Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Opening a specific file with GETFILE()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00567270
Message ID:
00567288
Vues:
15
>Is there a means to open and view a specific file from a form without knowing the file's format?
>
>I have been asked to add an ability to view attachment files, but have no way of knowing in advance of knowing whether the file will be .txt, .doc, .xls, or what.
>
>I was hoping to use GETFILE(), but either it isn't up to the job, or I'm not using it correctly.
>
>Help, please?

GETFILE() is a good start, but it only allows you to choose a file. If you want to do this the quick way, just let your users select a file with getfile(), then use the shellexecute API to display it, and let windows decide how to what sort of file it is.

This is the syntax:

cFile = GETFILE()

declare integer ShellExecute in SHELL32.dll integer nWinHandle,string cOperation,string cFileName,string cParameters,string cDirectory,integer nShowWindow
if !EMPTY(cFile) AND FILE(cFile)
ShellExecute(0,"OPEN",cFile,'',sys(2023),1)
endif

I hope this is what you were looking for.
Bill Mittenzwey
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform