/// <summary> /// ウィンドウクラスを元にハンドルを取得 /// </summary> /// <returns>Null if failed</returns> /// <param name="classname">Window class name</param> static public WindowHandle FindWindowByClass(string classname) { IntPtr hwnd = WinApi.FindWindow(classname, null); if (hwnd == IntPtr.Zero) { return(null); } WindowHandle window = new WindowHandle(); return(window); }
/// <summary> /// ウィンドウタイトルを元にハンドルを取得 /// </summary> /// <returns>Null if failed</returns> /// <param name="title">Window title</param> static public WindowHandle FindWindowByTitle(string title) { IntPtr hwnd = WinApi.FindWindow(null, title); if (hwnd == IntPtr.Zero) { return(null); } WindowHandle window = new WindowHandle(hwnd); return(window); }