Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Common Dialog: ShowOpen() errors out
Message
De
21/12/2004 12:43:08
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Common Dialog: ShowOpen() errors out
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00971064
Message ID:
00971064
Vues:
356
I am trying to use the Common Dialog Control, which I haven't used for a long time. I remember it used to work in the past. Now I'm getting an error in a new program I'm developing.

Sample code:
* setup Common Dialog Control
#define COMMDLOG_DEFAULT_FLAG 0x00080000
#define COMMDLOG_RO 4
#define COMMDLOG_MULTFILES 512
oleCommDlog=CreateObject("MSComDlg.CommonDialog.1")
oleCommDlog.Flags = COMMDLOG_DEFAULT_FLAG + COMMDLOG_RO + COMMDLOG_MULTFILES
oleCommDlog.FileName = "*.seq"
oleCommDlog.filter = "Stratus Log files|*.seq"
* Display file dialog
oleCommDlog.ShowOpen()   && <== IDispatch exception: insuff. memory error here
The ShowOpen() method fails with:
"OLE IDispatch exception code 0 from CommonDialog: The common dialog function failed during
initialization. This error often occurs when insufficient memory is available..."


The system uses WinXP. Memory is plentiful. Message is BS.
Note that other functions in the same ActiveX Common Control, like ShowPrinter for example, work fine.

The reason I need it is simply because I need multiple file selection, which I can't do with GetFile() (or can I?)

Anybody has any idea why this error? Or a workaround?

TIA,


[UPDATE]: I just remembered there is a Solutions sample that showcases the Common Dialog Control. I checked thee sample provided in commdlg.scx and it works fine there. The code seems to me to be basically the same. The only difference is that the sample form has the ActiveX dropped on the form. My code is all in a PRG, using CreateObject(). Why would it not work in the same box? Strange.

[2nd UPDATE]: I dropped the control in the form visually instead. It works!
Now why does it not work with CreateObject() and programmatic instantiation?
At least I have it working now.


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform