Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wrapper
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Wrapper
Miscellaneous
Thread ID:
00720723
Message ID:
00720723
Views:
41
Hi All

I have been trying to talk to a dll file for the last few days with out success. I need to have this working as soon as possible and was wondering if someone would put the following code into a wrapper using VB as I only has VFP5/6/7 and have never used VB. I need to be able to pass a file name and a string containing data. The information would then be uploaded to a electronic tag logger.

This example has the filename and file data hard coded into the program, I need to be able to pass this information in from VFP7. The dll also returns a number whether it succeeded or failed I need to be able to get this number back into VFP7 and display my own message.


Here is the VB code
'Define the datatype TagloggerFile, used by some of the DLL-functions
Public Type TagloggerFile
  filename(1 To 13) As Byte
  filelength As Long
End Type


Declare Function Logger_FileUpload Lib "Taglogger.dll" (ByRef filename As TagloggerFile, ByVal data As String) As Long


Dim file As TagloggerFile
  Dim data As String * 50000
  Dim filename As String
  Dim k As Integer
  Dim filedata As String
  Dim status As Long
    
 
* Filename and filedata need to be passed in to the wrappper.   
*  'Name and contents of the file to be uploaded to the Taglogger
*
*  filename = "dlltest1.txt"
*  filedata = "This is a test of the Logger_FileUpload function."
  
  
  '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))
     Else
      file.filename(k) = 0
    End If
  Next
  file.filelength = Len(filedata)
    data = filedata
  
  status = Logger_FileUpload(file, data)
  
  
* The code below just displays a message box telling us if the file upload was successfull, I need the value return to VFP from status.


*If status = 1 Then
*    cmdLoggerInit.Enabled = False
*    txtOut = ""
*    MsgBox "File " & filename & " was succesfully uploaded to the *Taglogger", vbOKOnly
*  Else
*    MsgBox "Logger_FileUpload returned error-code " & Str(status), *vbExclamation
*  End If
  
Please could someone create a wrapper using the above code, this would save my bacon.

Thanks

John
Reply
Map
View

Click here to load this message in the networking platform