由VisualBasic6组成的关于C#应用程序顶层不工作的表单程序

由VisualBasic6组成的关于C#应用程序顶层不工作的表单程序,c#,C#,首先,请理解我不擅长英语,所以我不擅长选择或写句子或单词 我对C#TopMost不工作有意见。 调用方法是在VB6的C#应用程序中调用的 根据每个具体情况表现出彼此不同的形式。 所有表格都有以下代码: // Define [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfte

首先,请理解我不擅长英语,所以我不擅长选择或写句子或单词

我对C#TopMost不工作有意见。 调用方法是在VB6的C#应用程序中调用的

根据每个具体情况表现出彼此不同的形式。 所有表格都有以下代码:

// Define
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);

private static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
private const UInt32 SWP_NOSIZE = 0x0001;
private const UInt32 SWP_NOMOVE = 0x0002;
private const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;
尽管如此,这是最重要的不工作。 如果你知道这个问题或者你能帮助我,我希望你能帮助我


祝你愉快。

你不工作是什么意思?它会抛出错误吗?您设置最高值的尝试是否会失败?具体来说,你好!嗯。。最上面的不起作用。没有错误,它们不起作用。你想达到什么目标?你为什么要把窗户尽量放在所有东西的上面?可能还有更好的方法。
表单
最顶层
属性不足以使其成为最顶层吗?你不可能超越每一个表单,如果你能设法拍摄一个屏幕截图来说明你想要实现的目标,这将是很有帮助的。也许我们可以帮助您实施更好的方法。
// All forms have the following code:
SetWindowPos(f.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
Commom.User32.AllowSetForegroundWindow((uint)Process.GetCurrentProcess().Id);
Commom.User32.SetForegroundWindow(h);
Commom.User32.ShowWindow(h, 1);
f.BringToFront();
f.TopLevel = true;
f.TopMost = true;
f.Focus();
// f is Form, h is Handle