Information générale
Catégorie:
Fonctions Windows API
>>BACKGROUND
>>
>>I have been using the Lotus Orgainizer 97 API in FoxPro with much success until recently. There is Organizer API function that returns a pointer (integer) to a memory location. Another Organizer API function is to be used to copy the memory at that pointer to a buffer. Unfortanately, I cannot get the VFP to recognize the API function. It gives me an error to the effect saying it cannot find the entry point in the DLL.
>>
>>There is a sample function call in Visual Basic. It uses the CALL statement to invoke the API function. The API function is declared in VB as such:
>>
>>Declare Sub hmemcpy Lib "OrgAPI32" Alias "OrgAPImemcpy" (...)
>>
>>QUESTIONS
>>
>>How do I DECLARE an API function in VFP to mimick the Declare Sub in Visual Basic? If this is not posible, is there a Windows API to do a memcpy? This API function would have to except an integer addrress as the source and character string as the destination. I tried using the Win32API function lstrcpyn with no success. It did not give me an error, but the destination string contained garbage.
>>
>>Thanks!
>
>Timothy,
>
>Yes, the Win32 API does have a function to copy the contents of a pointer into a buffer. Here's the declaration:
>
>DECLARE INTEGER lstrcpy IN Win32API;
> INTEGER lpString1, STRING @lpString2
>
>In order to use it, use the following syntax, where lnpointer equals the address of the string, and lcbuffer equals the buffer to receive the string.
>
>= lstrcpy(lnpointer, @lcbuffer)
>
>hth,
>
>George
Does this work if there are chr(0)s in the memory to be copied?
Vlad
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement