コード例 #1
0
 public WindowSearchData(EnumTitleSearchType searchType, string search)
 {
     _id         = Guid.NewGuid().GetHashCode();
     _searchType = searchType;
     _searchText = search;
     WindowFound = IntPtr.Zero;
 }
コード例 #2
0
        public static IntPtr FindWindowByTitle(string title, EnumTitleSearchType searchType)
        {
            WindowSearchData search = new WindowSearchData(searchType, title);
            IntPtr           p      = (IntPtr)search.ID;

            if (_windowSearchResults == null)
            {
                _windowSearchResults = new Dictionary <int, WindowSearchData>();
            }
            _windowSearchResults.Add(search.ID, search);
            EnumWindows(enumerateWindowsProcess, p);
            _windowSearchResults.Remove(search.ID);
            return(search.WindowFound);
        }