Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with DLL. Runs in VB, not VFP
Message
De
03/07/2002 04:20:33
 
 
À
02/07/2002 12:50:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00674563
Message ID:
00674867
Vues:
20
>Hi everyone. I am trying to make a clarion dll work inside of VFP 5.0 I was given sample VB that works, but I can't seem to get it to work in Foxpro.
>
>Here's the VB code:
>Private Declare Sub StringsToFromVB Lib "vFCla" (ByVal s1$, ByRef adr As Long)
>Dim tmp$
>Dim adr As Long
>tmp = Text1.Text
>Call StringsToFromVB(tmp, adr)
>
>The VFP code:
>DECLARE GET2STRINGS IN "vFCla.dll" AS "StringsToFromVB" STRING s1, LONG @adr
>tmp = ThisForm.Text1.Value
>adr = 0
>lcx = StringsToFromVB(tmp,@adr)
>
>My problem is this: In VB, the Clarion DLL displays the string that VB passes, then writes a string and updates the variable "adr" with a pointer to a string. VB then uses another DLL to go get the string, but that is not an issue at the moment. The issue that I have is that the Clarion DLL blows Foxpro out of the water when it tries to update the "adr" variable that I am trying to pass by reference.
>
>I don't know much about this stuff, but I know that the VB code I show above runs. In debugger, the "adr" variable is about a seven digit number when it's done. Foxpro just craps out.
>
>Can anyone with VB experience and VFP experience, help me out? I have tried using the @ symbols and not using them. Same result.
>
>Thanks in advance,
>Tim
This one works fine under VFP7:
LOCAL lnAddr, lcText  && Declare variables as local ones
DECLARE GET2STRINGS IN "vFCla.dll" AS "StringsToFromVB" STRING @ s1, LONG @ adr
* String parameters of API functions should be declared as passed by reference

lcText = ThisForm.Text1.Value

lnAddr = 0
lcx = StringsToFromVB(@lcText,@lnAddr) && both string and long variable passed by reference

DECLARE STRING agGetStringFromLPSTR IN "apigid32.dll" AS "agGetStringFromPointer" LONG ptr

ThisForm.Text2.Value = agGetStringFromPointer(lnAddr)

RETURN
If you have further problems - I'll be glad to help
HTH
Zlatin Zlatev,
MCSD (VS6)

Make solutions, not programs!

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform