Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert from VB
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Convert from VB
Divers
Thread ID:
00719715
Message ID:
00719715
Vues:
47
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform