public static IntPtr GetWindowHandleByTitle(string title)
 {
     try
     {
         title = title.ToLower();
         return(SEBWindowHandler.GetOpenWindows().FirstOrDefault <KeyValuePair <IntPtr, string> >((Func <KeyValuePair <IntPtr, string>, bool>)(lWindow => lWindow.Value.Contains(title))).Key);
     }
     catch (Exception ex)
     {
         return(IntPtr.Zero);
     }
 }
 public static List <IntPtr> GetWindowHandlesByTitle(string title)
 {
     try
     {
         title = title.ToLower();
         return(SEBWindowHandler.GetOpenWindows().Where <KeyValuePair <IntPtr, string> >((Func <KeyValuePair <IntPtr, string>, bool>)(lWindow => lWindow.Value.Contains(title))).Select <KeyValuePair <IntPtr, string>, IntPtr>((Func <KeyValuePair <IntPtr, string>, IntPtr>)(lWindow => lWindow.Key)).ToList <IntPtr>());
     }
     catch (Exception ex)
     {
         Logger.AddError("Unable to GetWindowHandlesByTitle " + title, (object)null, ex, (string)null);
         return(new List <IntPtr>());
     }
 }
Exemplo n.º 3
0
 public static IEnumerable <KeyValuePair <IntPtr, string> > GetOpenWindows(this Process process)
 {
     return(SEBWindowHandler.GetOpenWindows()
            .Where(oW => oW.Key.GetProcess().GetExecutableName() == process.GetExecutableName()));
 }
 private static void EditAllOpenWindows(SEBWindowHandler.ShowWindowCommand action)
 {
     foreach (KeyValuePair <IntPtr, string> openWindow in (IEnumerable <KeyValuePair <IntPtr, string> >)SEBWindowHandler.GetOpenWindows())
     {
         IntPtr key = openWindow.Key;
         if (!key.IsAllowed())
         {
             SEBWindowHandler.EditWindowByHandle(key, action, false);
         }
     }
 }