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: 23% [?]

Related posts:

  1. Add Drop Shadow to Borderless Form
  2. C# Focus TextBox on Form Load
  3. C# Convert String to Stream, and Stream to String
  4. Hide Form from Alt+Tab
  5. C# WinForms Form Event Order