Results 1 to 2 of 2

Thread: CopyMemory() crashes VB

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    Hello!

    Does anyone know why CopyMemory function crashes VB?

    Here's the code I use:
    Code:
        hLock = LockResource(hLoad)
        hSize = SizeofResource(hInst, hFind)
        
        ReDim b(0 To lsize) As Byte
        CopyMemory b(0), hLock, hSize
        
        FreeLibrary hInst
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  2. #2
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Angry Probably because I suggested it...

    hehe

    Sorry if I put you wrong. In my last post to you I included my CopyMemory decalre in case it is different to yours.

    If you are using the same as mine, then try this:

    Code:
    CopyMemory b(0), ByVal hLock, hSize
    thats because you want to tell CopyMemory to start copying memory from the VALUE of the variable "hLock"

    What you are doing is telling it to start copying form the LOCATION of the hLock variable...

    Cheers
    Paul Lewis

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