private void btn_GetWindowList_Click(object sender, EventArgs e) { AccessWin aw = new AccessWin(); AccessWin.WindowsTree wt = new AccessWin.WindowsTree(); IntPtr pt = aw.GetWindowHandlebyTitle(txt_APPTitle.Text); txt_handle.Text = pt.ToString("X"); //display the handle in textbox //IntPtr vHandle = new IntPtr(Convert.ToInt32(txt_hndle.Text, 16)); if (aw != null) { DataTable dt = new DataTable(); dt = aw.ListWindow(pt).toDatatable(); //dgv_list.DataSource = dt; AccessWin.WindowsTree wt2 = new AccessWin.WindowsTree(); wt2.GetfromDataTable(dt); DataTable dt2 = wt2.toDatatable(); dgv_list.DataSource = dt2; } }