Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to reference a COM exe from itself?
Message
 
À
17/08/2005 10:09:26
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01041632
Message ID:
01041645
Vues:
18
Hi Grigore,


I am not sure if I understand your question, just wanted to say that I do not use public properties, I always use protected properties and add a pair of get and set functions which I use to access or change it's values, although it is much more code, I find it better for me, for example:
loMyInstance		= CREATEOBJECT('myProject.myOLEClass')
IF NOT loMyInstance.setStatus('Instantiated')
	? loMyInstance.getLastError()
ENDIF


define class myOLEClass as Session OLEPUBLIC
	PROTECTED Status as String
	PROTECTED LastError as String
	
	FUNCTION getStatus() as String
		RETURN this.Status
	ENDFUNC
	
	FUNCTION setStatus(newStatus as String) as boolean

		IF VARTYPE(newStatus) = 'C' && and some other conditions
			this.Status		= newStatus
			RETURN .t.
		ENDIF
		this.LastError	= 'Invalid parameter passed to setStatus'
		RETURN .f.
	ENDFUNC
	
	FUNCTION getLastError() as String
		RETURN this.LastError
	ENDFUNC
	
	PROCEDURE Init() as VOID
		this.Status		= 'Ready'
		this.LastError	= ''
	ENDPROC
ENDDEFINE
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform