April 2008
Intermediate to advanced
704 pages
17h 49m
English
Problem
You need to call an unmanaged function, such as GetVersionEx, that accepts a structure as a parameter.
Solution
Define the structure in your VB .NET code. Use the attribute System.Runtime.InteropServices.StructLayoutAttribute to configure how the structure fields are laid out in memory. Use the Shared SizeOf method of the System.Runtime.InteropServices.Marshal class if you need to determine the size of the unmanaged structure in bytes.
How It Works
In VB .NET code, you are not able to directly control how type fields are laid out once the memory is allocated. Instead, the CLR is free to arrange fields to optimize performance, especially in the context of moving memory around during ...
Read now
Unlock full access