Dim numRef As Byte*
Fixed numRef = buffer
I have this thing that puzzles me. :omg: I suppose that fixed means that garbage collector isnt allowed anywhere near the memory location to prevent accidental removal. That I can do in VB.net. :thumbsup: On the other hand I have no idea what Byte* is, seems to me its a pointer, what I do know from debugging is that it seems to retain only the first element in buffer (which is an array of 1023 I think, irrelevant at this point). Does the pointer point only to the first element? :confused: So if you store 1023 bytes in byte* it retains only the first byte? Please help ;) Added more info at 12:00 The next line of code is the following;
flag2 = Win32.ReadFile(Me.m_handle, numRef, 50, (numBytesRead), AddressOf overlapped)
numref in this case is taken from the line before and hence flag2 returns boolean true. Interesting thing is, in my patchwork code I use the following
Dim flag2 As Boolean = False
Dim numRef As Byte() = Nothing
numBytesRead = Nothing
numRef = buffer
flag2 = False
flag2 = Win32Serijski.ReadFile(Me.m_handle, numRef, 50, numBytesRead, overl)
And in contrast to the original code, my flag2 ALWAYS returns TRUE, while in the original code it returns true only if theres NEW data in the buffer. :confused: