New article for VB.Net

Glad to see you got this working in .NET. It's a good example of passing structure pointers to the Win32 API from a managed environment.

Just a quick comment though. You call Marshal.FreeHGlobal() in the class' Finalize method, so keep in mind how long it may take for the Garbage Collector to actually free that unmanaged memory. The only way to ensure that the memory is freed in a timely manner is to call FreeHGlobal directly after AllocHGlobal or at least make sure to call the class' Dispose method after you're finished using it.
 
Back
Top