| 36 | }; |
| 37 | |
| 38 | static BOOL CALLBACK fillWindowTitles(HWND hwnd, LPARAM lp) |
| 39 | { |
| 40 | callbackContext *ctx = (callbackContext *)lp; |
| 41 | |
| 42 | DWORD pid = 0; |
| 43 | ctx->GetWindowThreadProcessId(hwnd, &pid); |
| 44 | |
| 45 | HWND parent = ctx->GetWindow(hwnd, GW_OWNER); |
| 46 | |
| 47 | if(parent != 0) |
| 48 | return TRUE; |
| 49 | |
| 50 | if(!ctx->IsWindowVisible(hwnd)) |
| 51 | return TRUE; |
| 52 | |
| 53 | for(QProcessInfo &info : ctx->list) |
| 54 | { |
| 55 | if(info.pid() == (uint32_t)pid) |
| 56 | { |
| 57 | int len = ctx->GetWindowTextLengthW(hwnd); |
| 58 | wchar_t *buf = new wchar_t[len + 1]; |
| 59 | ctx->GetWindowTextW(hwnd, buf, len + 1); |
| 60 | buf[len] = 0; |
| 61 | info.setWindowTitle(QString::fromStdWString(std::wstring(buf))); |
| 62 | delete[] buf; |
| 63 | return TRUE; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return TRUE; |
| 68 | } |
| 69 | |
| 70 | QProcessList QProcessInfo::enumerate(bool includeWindowTitles) |
| 71 | { |
nothing calls this directly
no test coverage detected