Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determining parameters to pass to a DLL.
Message
 
 
To
11/02/2002 08:52:58
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00618235
Message ID:
00618336
Views:
9
Paul,
It looks as though everything is a static length which makes it easier to work with in VFP.

You will need to convert everything to strings and concatenate them. Ex.

StringType = replicate(chr(0),40)
Reftype = replicate(replicate(chr(0),30),5)
VerifyData = replicate(chr(0),2)+Chr(0)+replicate(replicate(chr(0),90),250)

Integers need to be passed afte converting them to there C-style representation.
Integer = 32767 to -32768 = chr(mod(myNumber,256))+chr(int(myNumber/256))

I don't see a defintion for mkeytype so I can't provide that.

Because of the shear size of the structures and the difficulty in accessing bits and pieces of strings that size, I recommend writing a VB wrapper and using that in your VFP applications. An interface like that could make things a lot easier to understand down the line. I often do this when dealing with WinAPI functions that require structures even if they are possible in VFP alone.

HTH.

>Larry
>
>No problem. Here you go:
>
>regards
>paul
>>>>>>>>>>>>>>>>>>>>>>>>>
>Declarations
>
>Type stringtype
>    stringfield As String * 40
>End Type
>
>Type reftype
>    ref_field(5) As String * 30
>End Type
>
>Type VerifyData
>    PremiseCount As Integer
>    MoreData As String * 1
>    Premtable(250)  As String * 90
>
>Global vb_status As stringtype
>Global vb_premise As stringtype
>Global vb_postcode As stringtype
>Global vb_addr1 As stringtype
>Global vb_addr2 As stringtype
>Global vb_addr3 As stringtype
>Global vb_addr4 As stringtype
>Global vb_addr5 As stringtype
>Global vb_addr6 As stringtype
>Global vb_addr7 As stringtype
>Global vb_addr8 As stringtype
>Global vb_addr9 As stringtype
>Global vb_barcode As stringtype
>Global vb_matchkey As mkeytype
>Global vb_name32 As stringtype
>Global vb_dps As stringtype
>Global vb_error As stringtype
>Global vb_ref As reftype
>Global vb_verify As VerifyData
>
>Declare Sub RAPID Lib "cob4001.dll" (vb_status As stringtype, _
   vb_premise As stringtype, vb_postcode As stringtype, vb_name32 As stringtype, _
   vb_addr1 As stringtype, vb_addr2 As stringtype, vb_addr3 As stringtype, _
   vb_addr4 As stringtype, vb_addr5 As stringtype, vb_addr6 As stringtype, _
   vb_addr7 As stringtype, vb_addr8 As stringtype, vb_addr9 As stringtype, _
   vb_barcode As stringtype, vb_matchkey As mkeytype, vb_dps As stringtype, _
   vb_error As stringtype, vb_ref As reftype, vb_verify As VerifyData)
>
>    ' Take input address from Address array
>
>    vb_name32.stringfield = Address(0).Text
>    vb_addr1.stringfield = Address(1).Text
>    vb_addr2.stringfield = Address(2).Text
>    vb_addr3.stringfield = Address(3).Text
>    vb_addr4.stringfield = Address(4).Text
>    vb_addr5.stringfield = Address(5).Text
>    vb_addr6.stringfield = Address(6).Text
>    vb_addr7.stringfield = Address(7).Text
>    vb_addr8.stringfield = Address(8).Text
>    vb_addr9.stringfield = Address(9).Text
>    vb_dps.stringfield = " "
>    vb_matchkey.mkeyfield = " "
>    vb_status.stringfield = "P"      ' Call postcoding option
>
>    If mnuMKey.Checked = True Then   ' If matchkey selected
>        Mid$(vb_status.stringfield, 2, 1) = "M"
>        If option_CCODE <> 0 Then
>            Mid$(vb_status.stringfield, 5) = "C"
>        End If
>    End If
>
>    If mnuDPS.Checked = True Then   ' If matchkey selected
>        Mid$(vb_status.stringfield, 3, 1) = "D"
>    End If
>
>    Call RAPID(vb_status, vb_postcode, vb_premise, vb_name32, vb_addr1, _
        vb_addr2, vb_addr3, vb_addr4, vb_addr5, vb_addr6, vb_addr7, vb_addr8, _
        vb_addr9, vb_barcode, vb_matchkey, vb_dps, vb_error, vb_ref, vb_verify)
>
>    ' Address results are stored in vb_addr array
>
>    Result(0).Text = vb_premise.stringfield
>    Result(1).Text = vb_addr1.stringfield
>    Result(2).Text = vb_addr2.stringfield
>    Result(3).Text = vb_addr3.stringfield
>    Result(4).Text = vb_addr4.stringfield
>    Result(5).Text = vb_addr5.stringfield
>    Result(6).Text = vb_addr6.stringfield
>    Result(7).Text = vb_addr7.stringfield
>    Result(8).Text = vb_addr8.stringfield
>    If mnuDPS.Checked = True Then   ' checked
>        Result(9).Text = Left$(vb_dps.stringfield, 2)
>    Else
>        Result(9).Text = " "
>    End If
>    Result(10).Text = " "
>    If mnuMKey.Checked = True Then   ' checked
>        If option_CCODE = 0 Then
>            Result(10).Text = Mid$(vb_matchkey.mkeyfield, 5)
>        Else
>            Result(10).Text = vb_matchkey.mkeyfield
>        End If
>    End If
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform