使用C#发送鼠标点击一个按钮在任务栏任务栏、鼠标点击、按钮

2023-09-03 07:01:35 作者:单身狗独闯天下

在我目前工作的一个应用程序,要求是把外部应用程序的窗口到前台。使Win32 API调用,如BringWindowToTop和SetForeground窗不工作的所有时间。这是由于在Windows XP中的一些限制。我想这样做的,而不是被发送模拟鼠标单击任务栏而我希望会带来窗口前面的窗口的按钮。有谁知道这是可能的?

In an application that I am currently working on, a requirement is to bring a window of an external application to the foreground. Making Win32 API calls such as BringWindowToTop and SetForeground window do not work all the time. This is due to some restrictions within Windows XP. What I would like to do instead is send simulate a mouse click the window's button on the taskbar which I am hoping will bring the window to the front. Does anyone know how this is possible?

推荐答案

退房的部分,在 HTTP://www.$c$cproject.com/KB/dialog/dlgboxtricks.aspx ,因为这正是你所需要的。我不会在任务栏的路线为任务栏可以隐藏或根本不存在。

Check out the section "How to steal focus on 2K/XP" at http://www.codeproject.com/KB/dialog/dlgboxtricks.aspx, as this is exactly what you need. I wouldn't go the taskbar route as the taskbar could be hidden or simply not there.