Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert from VB
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Convert from VB
Miscellaneous
Thread ID:
00719715
Message ID:
00719715
Views:
45
Hi All

I need to work with a DLL there are some sample code supplied for VB and I am having trouble converting it to VFP7.

Here is the VB declare code.
Declare Function Logger_FileDownload Lib "Taglogger.dll" (ByRef filename As TagloggerFile, ByVal data As String) As Long
Here is the VB code.
Private Sub cmdFileDownload_Click()

  Dim status As Long
  Dim filename As String
  Dim file As TagloggerFile
  Dim data As String * 50000
  Dim k As Integer
  
  filename = InputBox("Which file do you want to download ?", "", "DLLTEST.TXT")
  If filename = "" Then Exit Sub
  
  If Len(filename) > 12 Then
    MsgBox "Filename too long!", vbCritical
  Else
  
    ' Convert string to array of bytes padded with nullbytes
    For k = 1 To 13
      If k <= Len(filename) Then
        file.filename(k) = Asc(Mid(filename, k, 1))
        MsgBox (VarType(file.filename(k)))
    Else
        file.filename(k) = 0
      End If
    Next
    
   
       status = Logger_FileDownload(file, data)
    If status = 1 Then
      txtOut = "Contents of " & filename & " (" & Str(file.filelength) & " bytes ):" & _
               vbCrLf & vbCrLf & Left(data, file.filelength)
    Else
      MsgBox "Logger_Reset returned error-code " & Str(status), vbExclamation
    End If
  
  End If

End Sub
Can anyone give me some ideas of how to convert this.

Thanks

John
Next
Reply
Map
View

Click here to load this message in the networking platform