Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pointer to a memory address
Message
 
 
To
21/10/2001 16:48:23
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00571491
Message ID:
00571504
Views:
22
This message has been marked as the solution to the initial question of the thread.
>Hello, All.
>
>I want to use CopyMemory function. Besides the fact this function does not exist (it's an alias), I have some problems with it.
>
>The following code works:
>
>
>DECLARE INTEGER GetCommandLine IN kernel32
>
>DECLARE RtlMoveMemory IN kernel32 As CopyMemory;
>    STRING  @ Destination,;
>    INTEGER   Source,;
>    INTEGER   nLength
>
>lnAddress = GetCommandLine()
>
>lpBuffer = SPACE(1024)
>= CopyMemory (@lpBuffer, lnAddress, Len(lpBuffer))
>
>
>The value of the GetCommandLine() function is numeric. In fact, is a pointer to a memory address.
>
>Now: I'd like to have the same feature with native VFP functions. For example, GETENV('PATH')
>
>
>lcString = GETENV('PATH')
>
>
>How can I obtain the memory address where the lcString is stored, to pass it to CopyMemory function?
>
>Thanks in advance.

Declare second parameter as a string passed by reference. This'll pass pointer to the string into function. Anyway it's not a good idea to keep a pointer to VFP memory variable because VFP could change string location in memory when it's doing internal "garbage collection".
DECLARE RtlMoveMemory IN kernel32 As CopyMemory;    
    STRING  @ Destination,;    
    <b>String  @ Source, </b>;    
    INTEGER   nLength
lpBuffer = SPACE(100)
lcTemp = Getenv("temp")
= CopyMemory (@lpBuffer, @lcTemp, Len(lpBuffer))
Take a look at file#986and file#9557 for some related info.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform