>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 GET2STRINGS IN "vFCla.dll" AS "StringsToFromVB" STRING @ s1, LONG @ adr
lcText = ThisForm.Text1.Value
lnAddr = 0
lcx = StringsToFromVB(@lcText,@lnAddr)
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!