Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getfile and putfile API-based replacement (non-ocx)?
Message
De
22/02/2006 09:37:19
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01097713
Message ID:
01098096
Vues:
21
>It's a bug in a sample form. It sets filter incorrectly.
>Check also Re: Descriptive File Types with PUTFILE() Thread #574248

Thank a million! The code below looks like a neat replacement for the usual getfile (or MS-OCX):

SET PATH TO "c:\program files\microsoft visual foxpro 9\ffc\" ADDITIVE

oCD = Newobject("_comdlg", "_system")

oCD.clearfilters(.T.)
oCD.AddFilter("Excel files (*.xls)", "*.xls")
oCD.AddFilter("Survey files (*.hrq)", "*.hrq")

* Dialog properties.
oCD.cTitlebarText = "Specify file name for output table"

* Initial defaults.
oCD.cFileName = "test.hrq"
oCD.cInitialDirectory = "c:\hroffice"
oCD.cDefaultExtension = "HRQ"
oCD.lSaveDialog = .t.

* Display the dialog and get results.
? oCD.showdialog()

It looks like a very basic error in the _system.AddFilter method (when the "list of Filters" was forced to cleared to nil...) prevented my code to work fine.

Here is the correction (for what it's worth):

IF EMPTY(THIS.aFilterList)
nNewRow = 1
ELSE
nNewRow = ALEN(THIS.aFilterList,1) + 1
ENDIF
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform