TRVCamera.FillVideoDeviceList suggestion

RVMedia support and discussion (components for displaying and controlling IP cameras, webcams, video conferencing, video chats, recording audio and video files)
Post Reply
oliver
Posts: 30
Joined: Mon Aug 28, 2017 4:42 am

TRVCamera.FillVideoDeviceList suggestion

Post 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.
Post Reply