public Table FindTable() { Table table = null; IntPtr found = IntPtr.Zero; EnumWindows(delegate(IntPtr wnd, IntPtr param) { String windowText = GetWindowText(wnd); // Console.WriteLine(windowText); if (windowText.Contains( "Hold'em" ) ) { found = wnd; } return true; }, IntPtr.Zero); if ( found != IntPtr.Zero ) { table = new Table(found); } return table; }
public Form1() { InitializeComponent(); finder = new TableFinder(); table = finder.FindTable(); if ( table == null ) { Console.WriteLine("Could not find table."); return; } tableTimer = new System.Timers.Timer(500); tableTimer.Elapsed += OnTimedEvent; tableTimer.Start(); }