最小化时跳转到窗口我想知道如何调出特定的窗口。SetForegroundWindow在窗口未最小化时起作用!但是当窗口最小化时,SetForegroundWindow不起作用......我的代码:intIdRemoto=int.Parse(textBoxID.Text);Process[]processlist=Process.GetProcessesByName("AA_v3.3");foreach(进程列表中的进程){if(!String.IsNullOrEmpty(process.MainWindowTitle)){if(IdRemoto.ToString()==process.MainWindowTitle)SetForegroundWindow(process.MainWindowHandle);}}[DllImport("user32.dll")]privatestaticexternboolSetForegroundWindow(IntPtrhWnd);您可以使用IsIconic()API检查窗口是否最小化,然后使用ShowWindow()将其恢复为显示的Houssem:publicconstintSW_RESTORE=9;[DllImport("user32.dll")]publicstaticexternboolIsIconic(IntPtrhandle);[DllImport("user32.dll")]publicstaticexternboolShowWindow(IntPtrhandle,intnCmdShow);[DllImport("user32.dll")]publicstaticexternintSetForegroundWindow(IntPtrhandle);privatevoidBringToForeground(IntPtrextHandle){if(IsIconic(extHandle)){ShowWindow(extHandle,SW_RESTORE);}放前景窗口(extHandle);您可以将ShowWindow与您已有的结合起来。这是你的例子,稍微修改一下:以上是C#学习教程:最小化时转到窗口。分享所有内容,如果对大家有用还有需要了解更多C#学习教程的,希望大家多多关注—intIdRemoto=int.Parse(textBoxID.Text);Process[]processlist=Process.GetProcessesByName("AA_v3.3");foreach(进程列表中的进程){if(!String.IsNullOrEmpty(process.MainWindowTitle)){if(IdRemoto.ToString()==process.MainWindowTitle){ShowWindow(process.MainWindowHandle,9);SetForegroundWindow(process.MainWindowHandle);}}}[DllImport("user32.dll")]privatestaticexternboolSetForegroundWindow(IntPtrhWnd);[DllImport("user32.dll")]privatestaticexternboolShowWindow(IntPtrhWind,intnCmdShow);如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处:
