BOOL CALLBACK WindowSelectEnum(HWND hWnd, LPARAM lParam) { TCHAR title[500] = L""; TCHAR wndTitle[500] = L""; std::vector<WindowDescriptor>* wndVec = (std::vector<WindowDescriptor>*) lParam; ZeroMemory(title, sizeof(title)); if (IsWindowVisible(hWnd)) { //GetWindowText(hWnd, title, sizeof(title) / sizeof(title[0])); DWORD PID = NULL; GetWindowThreadProcessId(hWnd, &PID); HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, PID); GetModuleFileNameEx(hProcess, NULL, title, sizeof(title) / sizeof(title[0])); //GetModuleFileName() //GetWindowModuleFileName(hWnd, title, sizeof(title) / sizeof(title[0])); TCHAR *name = wcsrchr(title, L'\\'); if (GetWindowText(hWnd, wndTitle, 500) > 0 && name != NULL) { //-------------------------------------------------- wndVec->push_back(WindowDescriptor(hWnd, std::wstring(wndTitle), std::wstring(name))); } //-------------------------------------------------- CloseHandle(hProcess); } return TRUE; }
/**RenderWindow class**/ RenderWindow::RenderWindow(unsigned int x, unsigned int y, unsigned int w, unsigned int h, float w_unit, float h_unit, char caption[], unsigned long int flags): BasicWindow(x, y, w, h, caption, flags), wunit(w_unit), hunit(h_unit), needResize(false) { renderer = SDL_CreateRenderer(WindowDescriptor(), -1, SDL_RENDERER_ACCELERATED); }