0

Good Evening. I understand the question may seem kind of odd, so let me explain my problem a little bit : Ii'm building a Windows From Application, that is able to open multiple Child Form, each one containing a WebBrowser component that loads a Flash animaion.

Now, I need to simulate a click on a given opened form, without it showing up on top of every other. To simulate the click, I'm using a code quite similar to https://stackoverflow.com/a/11161632/533599 : I had to implement 2 changes

  1. I have to stop to the "Internet Explorer_Server" , since I don't have a "MacromediaFlashPlayerActiveX" in the handles chain
  2. For the click to fire, I have to "make it double", that is, mouse down, up, down, up.

The code works quite well, and the click is fired, but everytime it does, the target Form gets focus and pops up on top of all his siblings ( but stays behind every other window I've opened over them). Is there a way to prevent this behaviour?

4

1 回答 1

0

目前我设法做一些类似于我需要的事情

[DllImportAttribute("user32.dll", EntryPoint = "SetForegroundWindow")]
[return: MarshalAsAttribute(UnmanagedType.Bool)]
public static extern bool SetForegroundWindow([InAttribute()] IntPtr hWnd);

[DllImportAttribute("user32.dll", EntryPoint = "GetForegroundWindow")]
public static extern IntPtr GetForegroundWindow();

[DllImportAttribute("user32.dll", EntryPoint = "BringWindowToTop")]
[return: MarshalAsAttribute(UnmanagedType.Bool)]
public static extern bool BringWindowToTop([InAttribute()] IntPtr hWnd);

IntPtr old = GetForegroundWindow();
LeftClick(hw, x, y);
SetForegroundWindow(old);
BringWindowToTop(old);

不利的一面是,“点击”的表单仍然会弹出几分之一秒,给人一种糟糕的风格效果。任何其他有助于将表单保持在后台的提示都是受欢迎的:)

于 2012-11-12T19:22:19.927 回答