文章标题

来源:互联网 发布:商家给淘宝开具什么 编辑:程序博客网 时间:2024/06/06 16:32

window 技巧

  • 将内存转到虚拟内存,降低物理内存占用
    SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
  • 设置窗口属性
QString str = "GWS_MAIN_FRAME";SetPropA((HWND)winId(), str.toLocal8Bit().constData(), (HWND)winId());QString str = "GWS_MAIN_FRAME";RemovePropA((HWND)winId(), str.toLocal8Bit().constData());
// 返回窗口句柄// findWindowByProp("GWS_MAIN_FRAME")int g_nWndCount;HWND g_wndList[2048];BOOL __stdcall EnumEachWindowsProc(HWND hWnd, LPARAM lparam){    if (g_nWndCount == 2048)        return false;    if (GetPropA(hWnd, (LPCSTR)lparam))    {        g_wndList[g_nWndCount] = hWnd;        ++g_nWndCount;    }    return true;}findWindowByProp(const QString &strPropName){    g_nWndCount = 0;    EnumWindows(EnumEachWindowsProc, (LPARAM)strPropName.toLocal8Bit().constData());    if (g_nWndCount > 0)        return g_wndList[0];    return NULL;}
0 0
原创粉丝点击