• 解决SetForegroundWindow和BringWindowToTop等函数有时失败,无法将窗口带到前台的问题


    C++代码
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    BOOL SetTopWindow(HWND hWnd)
     {
        HWND hForeWnd = GetForegroundWindow();
        DWORD dwForeID = GetWindowThreadProcessId(hForeWnd, NULL);
        DWORD dwCurID = GetCurrentThreadId();
        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);
        return TRUE;
     }
    描述:一个解决SetForegroundWindow和BringWindowToTop等函数有时失败,无法将窗口带到前台的问题。 以上是据说是微软的标准调用代码,包试包灵,童叟无欺,解决了困扰我很久的问题,有需要的赶紧收下吧!
  • 相关阅读:
    paramiko连接并配置交换机
    Paramiko-sftp上传和下载文件
    常做的性能测试包含哪些?
    术语?
    什么是【负载测试】和【压力测试】?
    什么是性能?
    web服务器
    兼容性测试?
    可用性测试?
    什么是【回归测试】?
  • 原文地址:https://www.cnblogs.com/fwycmengsoft/p/3008616.html
Copyright © 2020-2023  润新知