根据进程名获取
try
{
FormIntptr = Process.GetProcessesByName(textBox1.Text)[0].MainWindowHandle;
}
catch (Exception)
{
FormIntptr = IntPtr.Zero;
}
if (FormIntptr != IntPtr.Zero)
{
label2.Text = FormIntptr.ToString("X8");
IntPtr TimeLableIntptr = FindWindowEx(FormIntptr, IntPtr.Zero, "Button", "FileList");
if (TimeLableIntptr != IntPtr.Zero)
{
//获得Checkbox值
label5.Text = SendMessage(TimeLableIntptr, WM_GETTEXT, 0, 0);
//更改CheckBox值
//SendMessage(TimeLableIntptr, WM_SETTEXT, IntPtr.Zero, "内容");
}
}
评论