>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--