Page 1 of 1

TRVCamera.FillVideoDeviceList suggestion

Posted: Sun Jul 29, 2018 9:13 pm
by oliver
This function is very handy to get a list of webcams or monitors.

It would be great if this could also be used to get a list of visible windows for use with DesktopMode=rvdmWindow;

Here's the code for it I am using:

DWORD dwThreadId = GetCurrentThreadId();
HDESK hDesktop = GetThreadDesktop(dwThreadId);
EnumDesktopWindows (hDesktop, GetVisibleWindows, NULL);

BOOL CALLBACK GetVisibleWindows(HWND wnd, LPARAM lParam)
if (!IsWindowVisible(wnd)) return 1;
if (GetWindowTextLength (wnd) == 0) return 1;
TCHAR caption[MAX_CAPTION + 1];
GetWindowText(wnd, caption, MAX_CAPTION);
VideoForm->Sources->Items->Add (caption); // Store the caption
VideoForm->AppHandles.push_back (wnd); // Store the window handle
return 1;

Feel free to use/improve on it.