예제 #1
0
        private static bool CheckByName(IntPtr hWnd, String name, ref int rowId)
        {
            string winClass = WinAPI.GetWinClass(hWnd);

            if (winClass != "ListBox")
            {
                return(false);
            }

            //Console.WriteLine(string.Format("{0} {1}", hWnd.ToString("x8"), winClass));

            int rowNum = WinAPI.GetListBoxItemNum(hWnd);

            for (int i = 0; i < rowNum; i++)
            {
                string strText = WinAPI.GetListBoxItemText(hWnd, i);
                if (strText == name)
                {
                    rowId = i;
                    return(true);
                }
            }

            return(false);
        }