private static bool CheckByName(IntPtr hWnd, String name, ref int rowId) { string winClass = WinAPI.GetWinClass(hWnd); if (winClass != "SysListView32") { return(false); } //Console.WriteLine(string.Format("{0} {1}", hWnd.ToString("x8"), winClass)); int rowNum = WinAPI.GetListViewItemNum(hWnd); for (int i = 0; i < rowNum; i++) { string strText = WinAPI.GetListViewItemText(hWnd, i); if (strText.Contains(name)) { rowId = i; return(true); } } return(false); }