wpf 窗口最小化后,触发某事件弹出最小化窗口并置顶

时间:2021-03-15 09:21:46
//如果窗口最小化了弹出并置顶----事件触发调用
ShowWindowAsync(new System.Windows.Interop.WindowInteropHelper(CommonHelper.view).Handle, 1);
SetForegroundWindow(new System.Windows.Interop.WindowInteropHelper(CommonHelper.view).Handle);

  

[System.Runtime.InteropServices.DllImport("User32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern int SetForegroundWindow(IntPtr hWnd);