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

The only message is a VFP message saying Declare DLL call caused an excption.

The don't think the DLL requires registration, I can make other calls to it OK, but the file upload is causing problems.

I have tried removing the path but it still causes an error.

John



>>Hi Ed
>>
>>Thanks for the help. I have tried the following code, but just receive an Declare DLL call caused an excption error.
>>
>
>What type of error/exception was noted? Did you try declaring the DLL without specifying the exact path to it? Does the DLL require registration?
>
>>
>>
>>DECLARE INTEGER  Logger_FileUpload IN c:\windows\system\taglogger.dll STRING @ Tagloggerfile, STRING @DataBlock
>>
>>cUploadFileName = "TEST.TXT"
>>cDataBlock = "This is a test text for the dll file"
>>
>>SET LIBRARY TO "d:\vfp projects2\vfp base\clsheap.prg" ADDITIVE
>>
>>cTaggerLogFileStruc = PADR(ALLTRIM(cUploadFileName),13,chr(0)) + NumToLong(LEN(cDataBlock))
>>nResult = Logger_FileUpload(@cTaggerLogFileStruc,@cDataBlock)
>>MESSAGEBOX(nResult)
>>
>>
>>
>>John
>>
>>>>Hi Jose
>>>>
>>>>Thanks for the code.
>>>>
>>>>I am also having trouble using the Logger_File_Upload and was wondering if you have any ideas why it won't work.
>>>>
>>>>
>>>>Here's the VB code
>>>>
>>>>
>>>>
>>>>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
>>>>
>>>
>>>The API declaration should read:
>>>
>>>
DECLARE INTEGER  Logger_FileUpload IN TagLogger.DLL STRING @ Tagloggerfile, STRING @ DataBlock
>>>
>>>The Tagloggerfile structure should consist of a null padded 8.3 format name, followed by a 4 byte file length, representing the length of the data to be written. Using the NumToLong() function from my ClsHeap library (available for download in the download section as Heap Allocation Class), I'd construct it as:
>>>
>>>
cTaggerLogFileStruc = PADR(ALLTRIM(cUploadFileName),13,chr(0)) + NumToLong(LEN(cDataBlock))
>>>nResult = Logger_FileUpload(@cTaggerLogFileStruc,cDataBlock)
>>>
>>>

>>>>
>>>>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
>>>>
>>>>
>>>> 'Name and contents of the file to be uploaded to the Taglogger
>>>> filename = "dlltest.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))
>>>> MsgBox (Asc(Mid(filename, k, 1)))
>>>> Else
>>>> file.filename(k) = 0
>>>> End If
>>>> Next
>>>>
>>>> file.filelength = Len(filedata)
>>>>
>>>> data = filedata
>>>>
>>>> status = Logger_FileUpload(file, data)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform