示例#1
0
 public static IntPtr FindWindowByClass(string className)
 {
     foreach (var hwnd in WindowHelper.EnumAllWindows())
     {
         if (WindowHelper.GetClassName(hwnd).Equals(className, StringComparison.Ordinal))
         {
             return(hwnd);
         }
     }
     return(IntPtr.Zero);
 }
示例#2
0
 public static IntPtr FindWindowByTitle(string windowTitle)
 {
     foreach (var hwnd in WindowHelper.EnumAllWindows())
     {
         if (WindowHelper.GetWindowText(hwnd).Equals(windowTitle, StringComparison.Ordinal))
         {
             return(hwnd);
         }
     }
     return(IntPtr.Zero);
 }