激活窗口,并前台显示:

//如果最小化了窗口, 就先恢复
if(IsIconic(hWnd))
{
    ShowWindow(hWnd, SW_RESTORE);
}

//激活窗口,并前台显示窗口
HWND hForeWnd = GetForegroundWindow();
DWORD dwCurID = GetCurrentThreadId();
DWORD dwForeID = GetWindowThreadProcessId(hForeWnd, NULL);
AttachThreadInput(dwCurID, dwForeID, TRUE);
//ShowWindow(hWnd, SW_SHOWNORMAL);
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
SetForegroundWindow(hWnd); //前台显示
AttachThreadInput(dwCurID, dwForeID, FALSE);

来自:https://www.cnblogs.com/dengpeng1004/p/5049646.html

相关文章:

  • 2022-01-16
  • 2022-12-23
  • 2021-10-01
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
  • 2021-06-25
相关资源
相似解决方案