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

Well I declared RtlMoveMemory as:
DECLARE INTEGER RtlMoveMemory IN KERNEL32.DLL ;
  STRING hpvDest, ;
  LONG hpvSource, ;
  LONG nBytes
but I don't know if that is a correct translation. The VB code defines the parameters as ANY, ANY, and LONG respectively. But VFP does not have an ANY variable type and hpvSource is a numeric variable containing a pointer.

Then I call it like this:
bytePhrase = SPACE(500)
trtl_error = RtlMoveMemory( bytePhrase, lngStrAddress, 500 )
which shows that (a) I am missing the VarPtr() function the VB code is using and bytePhrase is not a Byte variable type which the VB code uses. Hence I get error -5 returned and bytePhrase remains empty.

All the VFP code prior to calling RtlMoveMemory() is several calls to a 3rd party DLL. All calls to this DLL return ok status and end up giving me a pointer contained in the lngStrAddress variable. The 3rd party DLL help says that at this address:

The string may contain single-byte or double-byte characters. This is why it is of type void **. The application should copy the contents into a more permanent location.


Thats really it...
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