Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
NEWOBJECT() vs. CREATEOBJECT()
Message
De
04/02/2004 09:49:31
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00873856
Message ID:
00873888
Vues:
26
Einar,

>The question is:
>What is the difference between NEWOBJECT() and CREATEOBJECT()?

The big difference is that NEWOBJECT() allows you to specify the VCX or PRG that the class you want to instantiate resides in, in addition to the APP or EXE if you choose to list the VCX. NEWOBJECT then does an internal SET CLASSLIB TO whatever.vcx ADDITIVE or SET PROCEDURE TO whatever.prg ADDITIVE, instantiates the class, then sets your CLASSLIB or PROCEDURE settings back to the way they were.

It's unfortunate that the help gives just a simple example of instantiating a COM server, which looks just like CREATEOBJECT.

I could, for example, instantiate a class in a PRG like this without having to add BusinessObjects.prg to my SET PROCEDURE settings:

oCust=NEWOBJECT("CustomerBO", "BusinessObjects.prg")

Is there a particular reason you want to use NEWOBJECT with a COM Server? Does CREATEOBJECT not do the job?

You might find the wiki topic helpful:

http://fox.wikis.com/wc.dll?Wiki~NewObject~VFP
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform