So have seen a ton of people with the same issue s but no answers. My SendMessage pop s up the "Video Source" dialog box on a windows 7 laptop with one camera. I have Cyber Link YouCam installed.
如果我卸载网络链接, “ Video 源代码” 对话框就会消失。 看来 OS 正在运行, 好像YouCam 是同一设备的第二个驱动程序 。 我的问题是我如何阻止“ Video 源代码” 的对话框出现? 一旦我在对话框中选择一个选项, 我将无法获取对话框( 直到我重新启动应用程序), 因此必须设置一个设置 。
尽管调试找到了这个部分的代码(见下文整节), 似乎是调用对话框的代码之一 — SendMessage (DeviceHandle, WM_CAP_CONNECT, 设备no, (IntPtr) 0 Toint32 () 。)
public void StartWebCam (int height, int width, int handleofthepicturebox, int deviceno)
{
string deviceIndex = "" + deviceno;
deviceHandle = capCreateCaptureWindowA (ref deviceIndex, WS_VISIBLE | WS_CHILD, 0, 0, width, height, handleofthepicturebox, 0);
if (SendMessage (deviceHandle, WM_CAP_CONNECT, deviceno, ((IntPtr) 0).ToInt32 ()) > 0)
{
SendMessage (deviceHandle, WM_CAP_SET_SCALE, -1, 0);
SendMessage (deviceHandle, WM_CAP_SET_PREVIEWRATE, 0x42, 0);
SendMessage (deviceHandle, WM_CAP_SET_PREVIEW, -1, 0);
}
else
{
// nothing failed maybe some clean up needed
}
}
问题是,我该如何阻止“ Video Source” 的对话框出现?