using System.Windows.Interop;
//使用WindowInteropHelper类可以获得窗体句柄
int handle = new WindowInteropHelper(this).Handle.ToInt32();