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());
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;
}