selecting a device without UI
-
More like working with Video For Windows API in this case. Devices is too generic a term. In fact most people do this using DirectShow instead of VFW these days. My suggestion to how to get the device index that you want.
for (i=0; i<10; i++)
{
if(capGetDriverDescription(i, szDeviceName, sizeof(szDeviceName), szDeviceVersion, sizeof(szDeviceVersion)) )
{
if(strcmp(szDeviceName, "MyDeviceName") == 0)
{
SendMessage( hwndVideo, WM_CAP_DRIVER_CONNECT, i, 0L);
break;
}
}
}Look at this to see how he enumerates the Video For Windows devices main.cpp: Line 185
int TForm1::EnumCapDrv() // enumerate the installed capture drivers
main.cpp: Line 118
SendMessage( hwndVideo, WM_CAP_DRIVER_CONNECT, sel, 0L);
main.cpp: Line 115
SendMessage( hwndSelCapDrvDlg_LBox, LB_GETSELITEMS, 1, sel);
Should be
SendMessage( hwndSelCapDrvDlg_LBox, LB_GETSELITEMS, 1, &sel);
Or it will only set the device to index 0, as sel was initialised to 0.
-
I use two webcams in my project and want to switch between them without oppenning UI window . kindly ask to send the code for switching between two cameras .
Does sending the
WM_CAP_DRIVER_CONNECT
message not work?SendMessage(hwndVideo, WM_CAP_DRIVER_CONNECT, camIndex, 0L);
or the macro
capDriverConnect(hwndVideo, camIndex);
What problems are you facing?
-
Does sending the
WM_CAP_DRIVER_CONNECT
message not work?SendMessage(hwndVideo, WM_CAP_DRIVER_CONNECT, camIndex, 0L);
or the macro
capDriverConnect(hwndVideo, camIndex);
What problems are you facing?
-
Um. Windows recognizes both webcams as in... they both have VFW drivers? Did you see the webcams listed in the listbox of this application?
-
Um. Windows recognizes both webcams as in... they both have VFW drivers? Did you see the webcams listed in the listbox of this application?
-
Yes I can choose between two webcams in windows UI dialog . but as mentioned above when I put the camIndex=1 it doesn't recognize it.
What windows UI dialog? Is it present in the SelCapDrvDlg in this application? Set a breakpoint in main.cpp line 199. What are the indexes of the 2 webcams you are interested in?
-
What windows UI dialog? Is it present in the SelCapDrvDlg in this application? Set a breakpoint in main.cpp line 199. What are the indexes of the 2 webcams you are interested in?
-
And there we have it. One of your webcams only has a WDM driver. You would have to write a DirectShow application.
-
And there we have it. One of your webcams only has a WDM driver. You would have to write a DirectShow application.
-
If you have VC7+, download and install the latest Platform SDK. Go to http://tmhare.mvps.org/downloads.htm[^] to get the project files for the samples since Microsoft has for some reason stripped it out. Then go have a look at the PlayCap sample application in "..\Program Files\Microsoft Platform SDK\Samples\Multimedia\DirectShow\Capture\PlayCap" If you have VC6 though, you would have to grab an old DirectX SDK, maybe 2003 or 2004.
-
If you have VC7+, download and install the latest Platform SDK. Go to http://tmhare.mvps.org/downloads.htm[^] to get the project files for the samples since Microsoft has for some reason stripped it out. Then go have a look at the PlayCap sample application in "..\Program Files\Microsoft Platform SDK\Samples\Multimedia\DirectShow\Capture\PlayCap" If you have VC6 though, you would have to grab an old DirectX SDK, maybe 2003 or 2004.
-
VC7+: Microsoft Visual C++ 2002/2003/2005 SDK: Software Development Kit http://www.microsoft.com/downloads/details.aspx?FamilyId=484269E2-3B89-47E3-8EB7-1F2BE6D7123A&displaylang=en[^]
-
VC7+: Microsoft Visual C++ 2002/2003/2005 SDK: Software Development Kit http://www.microsoft.com/downloads/details.aspx?FamilyId=484269E2-3B89-47E3-8EB7-1F2BE6D7123A&displaylang=en[^]
-
Your copy of Visual Studio .NET doesn't come with the C++ compiler? I never used CBuilder before so I guess you're on your own in building/getting compatible libs. Here's a link to get you started. http://www.geocities.com/foetsch/borlibs/[^] http://clootie.narod.ru/cbuilder/index.html[^]
-
Your copy of Visual Studio .NET doesn't come with the C++ compiler? I never used CBuilder before so I guess you're on your own in building/getting compatible libs. Here's a link to get you started. http://www.geocities.com/foetsch/borlibs/[^] http://clootie.narod.ru/cbuilder/index.html[^]