Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling a VB6 function in VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00928678
Message ID:
00928788
Vues:
60
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform