0

我用 C# 编写了一个应用程序,它将另一个应用程序带到了前台。

这个功能到此为止。但是,有一个问题。

如果您设置焦点,应用程序将打开并置于前台,但 Windows 停靠功能不起作用。该应用程序仅以其最后一个窗口大小打开。

编辑:我忘了提到应该在 Windows 桌面(显示器边缘)上看到对接。

有谁知道如何打开对接功能?

        [DllImport("../user32.dll")]
        private static extern bool SetForegroundWindow(IntPtr hWnd);

        [DllImport("../user32.dll")]
        private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

        public void SetWindowToForeground(List<string> formattedPartList)
        {
            string windowTitle = formattedPartList[4];
            int activeResize = 5; // 

            IntPtr mainWindowHandle = GetProcessIdByName(windowTitle);
  
            SetForegroundWindow(mainWindowHandle);
            ShowWindow(mainWindowHandle, activeResize);
        }
4

0 回答 0