Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can anybody help me creating a class
Message
De
10/08/1998 10:21:54
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00125162
Message ID:
00125238
Vues:
9
>You have to create a class and make it OLEPUBLIC to make it an OLE server. You create a public method that would do the ALTER TABLE command. Then you just call that method of the server.
>
>How you create the OLE server instance depends on the language you are trying to call the server from. From VFP and VB you can just CreateObject() the server, in VC++ you call the CreateDispatch() method of a class derived from COleDispatchDriver.
>
>Look in the \vfp\samples\servers folder for some code.
>

Here is the code that I wrote in Visual Foxpro.
******

define class vfield as custom olepublic
procedure insfld
parameters tabname,fldname,fldtype,fldsize

kpk = ""
kpk = "ALTER TABLE " + tabname + " ADD column " + ;
fldname + " " + datype + "(" + datsize + ")"

messagebox (kpk)

&kpk
endproc
enddefine


Now I created the DLL, and it created the DLL, but when I used the procedure
insfld from VB with following code,
**********
declare sub insfld lib "c:\temp1\vfield.dll" (st1 as atring, st2 as string, st3 as string, st4 as string)

call insfld("main.dbf","psr","C","20")

*********

It gave error , can't find insfld

************


One more question :
Can I use Fpole.dll to execute a Foxcommand from VB ?
I tried but it said Bad DLL calling.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform