Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can anybody help me creating a class
Message
 
 
To
10/08/1998 10:21:54
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00125162
Message ID:
00125254
Views:
14
You aren't creating a callable DLL like a WinAPI DLL call. You've created an OLE server. I'm not a VB programmer, but your VB code should look more like:

dimension oVFP as object
oVFP = CreateObject( "classlibname.vfield" )
oVFP.InsFld()

I use .vcx files for my servers. I'm not sure what the first part of the server name should be. I'd try the base filename of the DLL file.

I think I'd also code it just a little different so VFP knows it needs to include support for the ALTER TABLE command when it compiles:

kpk = tabname + " ADD column " + ...
alter table &kpk

that is only macro expand the clauses of the command and not the whole command.

>>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.
>>
>
>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.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform