private bool SubclassSupergrid() { try { ParentWindow = FindOutlookWindow(); if (ParentWindow == IntPtr.Zero) { return(false); } var hnds = SafeNativeMethods.FindDescendantWindows(this.ParentWindow, "SUPERGRID", true); if (hnds.Length == 0) { return(false); // The task is not yet over, we'll try finding the windows at next attempt. } _subclassSuperGrids = new List <SubclassedWindow>(); foreach (var hnd in hnds) { var subclass = new SubclassedWindow(); subclass.KeyMessage += new SubclassedWindow.KeyMessageEvent(subclassSuperGrid_KeyMessage); subclass.Destroyed += (object sender, EventArgs e) => Init(); subclass.AssignHandle(hnd); _subclassSuperGrids.Add(subclass); } } catch (Exception ex) { ExceptionHandler.Catch(ex, start: "Oops, error occured on initialization for key hooking"); } return(true); }
private bool SubclassSupergrid() { try { ParentWindow = FindOutlookWindow(); if (ParentWindow == IntPtr.Zero) { return false; } var hnds = SafeNativeMethods.FindDescendantWindows(this.ParentWindow, "SUPERGRID", true); if (hnds.Length == 0) { return false; // The task is not yet over, we'll try finding the windows at next attempt. } _subclassSuperGrids = new List<SubclassedWindow>(); foreach (var hnd in hnds) { var subclass = new SubclassedWindow(); subclass.KeyMessage += new SubclassedWindow.KeyMessageEvent(subclassSuperGrid_KeyMessage); subclass.Destroyed += (object sender, EventArgs e) => Init(); subclass.AssignHandle(hnd); _subclassSuperGrids.Add(subclass); } } catch (Exception ex) { ExceptionHandler.Catch(ex, start: "Oops, error occured on initialization for key hooking"); } return true; }