Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting a VB DLL declaration and function
Message
From
19/04/2007 07:54:32
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01217662
Message ID:
01217674
Views:
7
Hi Sergey

Well, the exact declaration from the VB code is:
Private Declare Sub RtlMoveMemory Lib "kernel32" (ByVal hpvDest As Any, ByVal hpvSource As Any, ByVal nBytes As Long)
The parameters passed are setup as:
Dim lngStrAddress As Long
Dim bytePhrase(500) As Byte
Then lngStrAddress is set to a memory pointer. So far I have all that working as well and I do have the memory pointer in VFP as well. So far, so good. Then the VB code passes this memory pointer to the RtlMoveMemory() function as:
RtlMoveMemory VarPtr(bytePhrase(0)), lngStrAddress, 500
My version of the RtlMoveMemory() declaration gives me an error -5 at this point.

The VB code then goes on to convert the bytePhrase variable contents as:
ByteToString = StrConv(bytePhrase, vbUnicode)
Thats what the VB code does. I am obviously failing to correctly call the RtlMoveMemory() function. I think because I don't do the VarPtr() function and/or because of incorrect parameter declaration. But the above is the exact commands from the VB code.
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform