Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling a function with foxtools.fll
Message
 
To
09/06/1998 14:30:12
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00106418
Message ID:
00106483
Views:
24
>Hi all!
>I have a question.
>
>Im acessing a 16bit .dll file to read values from a PLC and have some problems the code is like this:
>
>
>SET UDFPARMS TO value
>
>SET DEFAULT TO C:\dbf\testapi
>IF !"FOXTOOLS" $ SET("library")
>SET LIBRARY TO (SYS(2004)+"FOXTOOLS")
>lLoaded = .T.
>ENDIF
>
>perstr=''
>
>Portpa = RegFn("PCDSetParameter","III","I","c:windows\system\promosvb.dll")
>Porton = RegFn("PCDOpen","","I","c:\windows\system\promosvb.dll")
>Stasjon= RegFn("PCDSetStation","I","","c\windows\system\promosvb.dll")
>LesR=
>RegFn("PCDReadRegister","IIC","I","c\windows\system\promosvb.dll")
>
>per= CallFn(Portpa,1,19200,1)
>per1=CallFn(Porton)
>per3=CallFn(Stasjon,1)
>per2=CallFn(LesR,500,1,perstr)
>
>The PCDreadregister have the following parameters
>integer adress =start adress off register in PLC
>integer count =number off registers to read
>long value =array with return values
>
>I dont know how to return a valid value I have tried with
>@ in "PCDReadRegister","II@C"
>
>I have tried with @perstr then I got an error:
>Param 2 wrong got R expected C??
>
>
>If you know please help
>
>Best regards
>
>Per Simmersholm

In addition to what Andrew said. You also need to initialize the perstr to the size of the array you need, not a null string. For example, if it needs to hold four DWORDS (4 bytes integers), you'd say:

perstr = SPACE(16)

This will make certain that the memory for the values is properly allocated.

hth,
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform