Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert from VB
Message
From
10/11/2002 10:55:35
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00719715
Message ID:
00720755
Views:
10
>Hi Ed
>
>Sorry to bother you again but I have managed to make some of the code work.
>The following code does not cause an error. The line I added was
>
>
> cDataBlock = REPLICATE(CHR(0),5000)
>
>
>The file is now uploaded but there is no data uploaded. I was wondering if it had something to do with where the cDataBlock is stored in memory?
>

You can try using a static block to pass the data; using ClsHeap, try this:
DECLARE Long Logger_Init IN c:\windows\system\taglogger.dll Long ComPort
i = Logger_Init(2)


DECLARE INTEGER  Logger_FileUpload IN c:\windows\system\taglogger.dll STRING @ Tagloggerfile, INTEGER lpDatablock
SET PROC TO "d:\vfp projects2\vfp base\clsheap.prg" ADDI
oHeap = CREATEOBJ('Heap')
cUploadFileName = "Test.txt"
cDataBlock = "Hello"
nBuffPointer = oHeap.AllocString(cDataBlock)

cTaggerLogFileStruc = PADR(ALLTRIM(cUploadFileName),13,chr(0)) + NumToLong(LEN(cDataBlock))

nResult = Logger_FileUpload(@cTaggerLogFileStruc,nBuffPointer)
oHeap.Dealloc(nBuffPointer)
>John
>
>
>
>
>DECLARE Long Logger_Init IN c:\windows\system\taglogger.dll Long ComPort
>i = Logger_Init(2)
>
>
>DECLARE INTEGER  Logger_FileUpload IN c:\windows\system\taglogger.dll STRING @ Tagloggerfile, STRING @ DataBlock
>
>
>SET PROC TO "d:\vfp projects2\vfp base\clsheap.prg" ADDI
>
>
>cDataBlock = REPLICATE(CHR(0),5000)
>
>
>cUploadFileName = "Test.txt"
>cDataBlock = "Hello"
>
>cTaggerLogFileStruc = PADR(ALLTRIM(cUploadFileName),13,chr(0)) + NumToLong(LEN(cDataBlock))
>
>nResult = Logger_FileUpload(@cTaggerLogFileStruc,cDataBlock)
>
>
>
>
>
>>>The error occurs when it reached the lnStatus = Logger_FileUpload(@lcFileStruc, @lcData) part
>>>
>>
>>Just out of curiousity, did you ever try appending a NULL character to the end of your data buffer? Maybe it expects a null terminator in the last position - I can't imagine why since you have to pass it a filelength, but it's worth a SWAG.
>>
>>>John.
>>>
>>>>>How do I find out?
>>>>>
>>>>
>>>>I can't see anything; it looks like the code should be correct. It's actually blowing yp at the point that you are doing the DECLARE...DLL; the only thing I can suggest is to try using the FOXTOOLS RegFn() and CallFn() routines to see if they handle it any better, or write a wrapper in VB.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform