CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Copy Memory

  1. #1
    Join Date
    Nov 1999
    Posts
    3

    Copy Memory

    Hi,
    I am using the API call CopyMemory in my code. It works fine when my source is of datatype long/int. But the program crashes when source is of any other data type like string.

    Does this call accept only long data type, if yes can anybody hint me how to convert a string to long and then get this back.

    ------------------------------------------------------------------------

    private Declare Sub CopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (Destination as Any, Source as Any, byval Length as Long)





    Your view on this issue will be of great help.

    Cheers,
    Bin.


  2. #2
    Join Date
    Sep 1999
    Posts
    18

    Re: Copy Memory

    Try with fixed length string


  3. #3
    Join Date
    May 1999
    Posts
    3,332

    Re: Copy Memory


    use the Byval keyword in your call as in:

    Declare Sub CopyMemoryD Lib “KERNEL32” Alias “RtlMoveMemory” ( _ lpvDest as Any, lpvSource as Any, byval cbCopy as Long)
    CopyMemoryD byval sDstD, byval sSrc, len(sSrc)



    "stolen" from MSDN


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured