C# 最大化过程不起作用
我正在尝试使用以下代码最大化“Microsoft扫雷器”(Windows 10)进程:C# 最大化过程不起作用,c#,minimize,minesweeper,C#,Minimize,Minesweeper,我正在尝试使用以下代码最大化“Microsoft扫雷器”(Windows 10)进程: static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)] private const int SW_MAXIMIZE = 3; IntPtr HWND = FindWind
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
private const int SW_MAXIMIZE = 3;
IntPtr HWND = FindWindow(null, "Microsoft Minesweeper");
ShowWindow(HWND, SW_MAXIMIZE);
起初这是可行的,但由于某种原因,在我最小化它之后,代码就不再有效了。我在另一个进程(记事本)上检查了该代码,它工作得很好,即使在我最小化记事本之后。然而,由于某些原因,“微软扫雷舰”不起作用
知道我最小化后它为什么不工作吗?最小化扫雷器时窗口文本会改变吗?不,顺便说一句,我还尝试使用:Process.getProcessByName(“扫雷器”)获取进程,并使用PostMessage()获得相同的结果。