您的位置:首页 > 编程语言 > C#

C#判断某个窗口已成为活动窗口

2011-01-30 20:20 218 查看
代码

[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();

foreach (Process thisproc in Process.GetProcessesByName("MeetingClient"))//进程名
{
if (thisproc.MainWindowHandle.ToInt32() == GetForegroundWindow().ToInt32())
{
//当前为活动窗口时要执行的代码
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: