[英]How to get Child Process state(active or not) of a main window in another application using c#
我有一个客户端应用程序,在菜单选项卡中具有一些选项卡,如下所示 选择浏览标签后,我需要执行一些操作。 我如何在我的应用程序中获取该事件。 我想编写自己的应用程序来执行此操作。 我以这种方式尝试
int chars = 256;
StringBuilder buff = new StringBuilder(chars);
// Obtain the handle of the active window.
IntPtr handle = GetForegroundWindow();
if (GetWindowText(handle, buff, chars) > 0)
{
if (buff.ToString() == mainWindowName)
{
IntPtr WndToFind = FindWindowByCaption(IntPtr.zero, "Browse");
if(WndToFind != IntPtr.Zero)
{
MessageBox.Show("Inside Browse");
}
}
}
当“浏览”选项卡处于活动状态时,我想显示一些消息。 请帮我。
如果您使用的是tabcontrol,下面的代码将知道用户选择了哪个选项卡页。
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage2"])
{
...add your code here
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.