Copy memory function
-
Hai i have migrated the vb code into vb.net.When i was migrating i found that copy memory function cant able to work it seems. i am using the function Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef hpDest As any, ByVal hpSource As any, ByVal nBytes As Integer) and call the function inside form1.show Call CopyMemory(arrBarCodeInformation(0), ptrBarCodeInfo, size_Renamed) i have declared Public arrBarCodeInformation() As BarCodeInformation Public Structure BarCodeInformation Dim tRegionRect As rect Dim dwBarType As Integer Dim fOrientation As Single Dim lDecodeStatus As Integer Dim lNoOfCharacters As Integer Dim lpbDecodByteArray As Integer Dim lReserved As Integer Dim hReserved As Integer End Structure using this i want to copy the memory value from integer value into the structure variable.how can it been done.tell me the syntax are any function to copy memory :((
-
Hai i have migrated the vb code into vb.net.When i was migrating i found that copy memory function cant able to work it seems. i am using the function Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef hpDest As any, ByVal hpSource As any, ByVal nBytes As Integer) and call the function inside form1.show Call CopyMemory(arrBarCodeInformation(0), ptrBarCodeInfo, size_Renamed) i have declared Public arrBarCodeInformation() As BarCodeInformation Public Structure BarCodeInformation Dim tRegionRect As rect Dim dwBarType As Integer Dim fOrientation As Single Dim lDecodeStatus As Integer Dim lNoOfCharacters As Integer Dim lpbDecodByteArray As Integer Dim lReserved As Integer Dim hReserved As Integer End Structure using this i want to copy the memory value from integer value into the structure variable.how can it been done.tell me the syntax are any function to copy memory :((
You're not listening. You do NOT need CopyMemory to do this. You need to marshal this structure to your function properly. This is not done the same way it was under VB6. If you created and instance of this structure in your code and just want to assign a value to one of it's members, then all you have to do is something like this:
arrBarCodeInformation(0).dwBarType = 42
Other than that, you haven't described what your doing with this stuff, nor have you posted any of the code you're trying to convert to show us what you want it to do.
Dave Kreskowiak Microsoft MVP - Visual Basic