我想编写一个应用程序来处理某些用户操作.
应用程序将始终是透明的,应该点击进入.因此,将看到后面的窗口,并且当透明的应用程序点击时,我应该能够点击后面的窗口.我只想在透明的应用程序中处理某些用户操作(如双击).
是否有可能实现这一目标?任何指南都表示赞赏.
您可以从您的应用程序中进行假窗口点击:
[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo);
private const int MOUSEEVENTF_LEFTDOWN = 0x02;
private const int MOUSEEVENTF_LEFTUP = 0x04;
private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
private const int MOUSEEVENTF_RIGHTUP = 0x10;
private void Form_MouseClick(object sender, MouseEventArgs e)
{
this.Hide();
Point p = this.PointToScreen(e.Location);
mouse_event(MOUSEEVENTF_LEFTDOWN , p.X, p.Y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, p.X, p.Y, 0, 0);
this.Show();//since this.opacity = 0; form will never be really visible
}
Run Code Online (Sandbox Code Playgroud)
现在双击您就可以设置您想要的内容。
| 归档时间: |
|
| 查看次数: |
2174 次 |
| 最近记录: |