TRVCamera.FillVideoDeviceList suggestion

New product: VCL components for displaying and controlling IP cameras, webcams, video conferencing, video chats
Post Reply
oliver
Posts: 30
Joined: Mon Aug 28, 2017 4:42 am

TRVCamera.FillVideoDeviceList suggestion

Post by oliver » Sun Jul 29, 2018 9:13 pm

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