Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling a VB6 function in VFP
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00928678
Message ID:
00928788
Views:
61
A correction: the DLL type created by VB is ActiveX DLL, which makes it easier to use from FoxPro. You don't have to use the DECLARE statement in Visual FoxPro.

Here's an example:

- create new VB project ActiveX DLL
- name the project SampleDLL
- name the class SampleClass
- place the following code into class definition:
Option Explicit

Public Function function01(ByRef s1 As String, ByRef s2 As String) As Integer
    Dim result As Integer
    result = 1
    s2 = s1 & Trim(s2)
    function01 = result
End Function

Public Function function02(ByRef s1 As String) As String
    function02 = "http://" & s1
End Function
- build dll: File - Make SampleDll.dll
this will register your dll as well

Test both functions in FoxPro:
aa = CREATEOBJECT("SampleDll.SampleClass")
? aa.function02("www")
bb = "ccc"
? aa.function01("http://", @bb)
? bb
Both function01 and function02 do not make much sense :) just an example. The function02 has definitely better interface.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform