Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 最大化过程不起作用_C#_Minimize_Minesweeper - Fatal编程技术网

C# 最大化过程不起作用

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

我正在尝试使用以下代码最大化“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 = FindWindow(null, "Microsoft Minesweeper");
    ShowWindow(HWND, SW_MAXIMIZE);    
起初这是可行的,但由于某种原因,在我最小化它之后,代码就不再有效了。我在另一个进程(记事本)上检查了该代码,它工作得很好,即使在我最小化记事本之后。然而,由于某些原因,“微软扫雷舰”不起作用


知道我最小化后它为什么不工作吗?

最小化扫雷器时窗口文本会改变吗?不,顺便说一句,我还尝试使用:Process.getProcessByName(“扫雷器”)获取进程,并使用PostMessage()获得相同的结果。