Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crear DLL's en VFP y usarlas en VFP
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01022841
Message ID:
01022847
Views:
12
Ricardo,

Creas primero un projecto, digamos miProjectoDLL, luego creas un programa, digamos MiClase.PRG, donde escribes:
define class miClaseFoxDLL as Custom OLEPUBLIC
	FUNCTION Calcular(n,m)
		LOCAL nRet
		   nRet = (n * m)
		RETURN nRet
	endfunc
enddefine
Ahora compilas tu programa, por ejemplo usando la tercera opción COM SERVER (EXE) y luego ya puedes usarla usando
miClase = createobject('miProjectoDLL.miClaseFoxDLL') && Como vez es NombreProjecto.NombreClase
? myClase.Calcular(10, 30)
[Update]
Es mejor poner el tipo a los parametros y a los valores que devuelven las funciones, por ejemplo:
FUNCTION Calcular(n as Decimal, m as Decimal) as Decimal
"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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform