private IntPtr GetControlHandle(Control ctrl) { if(ctrl != null && !ctrl.IsDisposed) { return ctrl.Handle; } else { return IntPtr.Zero; } }