May 07
This is one of those things that's obvious once you know it. When dealing with COM, there is often a need to convert a WinForms Form object to an IntPtr handle, and vice versa.
Convert Handle to Form
static public Form GetForm( IntPtr handle ) { return handle == IntPtr.Zero ? null : Control.FromHandle( handle ) as Form; }
Convert Form to Handle
Form form = new Form(); IntPtr handle = form.Handle;
Popularity: 53% [?]
Copyright © 2007-8 Tiwebb Ltd. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without explicit permission from Tiwebb Ltd.

