拔出&插入USB webCame [英] unplug & plug USB webCame

查看:119
本文介绍了拔出&插入USB webCame的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我正在尝试使用C#代码重置USB网络摄像头,我在Google上搜索了很多文章,但没有得到任何有用的解决方案

这是我的代码:

System.Management.ObjectQuery objectQuery = new System.Management.ObjectQuery("select * from CIM_LogicalDevice ");
            
            // search and get the list
            System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher(objectQuery);
            System.Management.ManagementObjectCollection list = searcher.Get();
           
            // step through the list of devices
            label1.Text = list.Count.ToString();
                        
            foreach (System.Management.ManagementObject item in list)
            {
                listBox1.Items.Add(item.GetText(TextFormat.Mof));
                if (item.GetPropertyValue("caption").ToString().Contains("USB PC Camera"))
                {
                   
                    item.InvokeMethod("Reset", null);
                }
            }


到达零件item.InvokeMethod("Reset", null);
时,总是会给我一个错误 它说:This method is not implemented in any class
请任何帮助
谢谢

解决方案

您必须使用..正确的WebCam Driver dll文件,并在项目中使用该dll ..并使用该dll的方法.


hi I''m trying to reset my USB web-came using c# code,and I googled a lot of articles but didn''t get any useful solution

here''s my code:

System.Management.ObjectQuery objectQuery = new System.Management.ObjectQuery("select * from CIM_LogicalDevice ");
            
            // search and get the list
            System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher(objectQuery);
            System.Management.ManagementObjectCollection list = searcher.Get();
           
            // step through the list of devices
            label1.Text = list.Count.ToString();
                        
            foreach (System.Management.ManagementObject item in list)
            {
                listBox1.Items.Add(item.GetText(TextFormat.Mof));
                if (item.GetPropertyValue("caption").ToString().Contains("USB PC Camera"))
                {
                   
                    item.InvokeMethod("Reset", null);
                }
            }


it always give me an error when it get to the part item.InvokeMethod("Reset", null);
it says: This method is not implemented in any class
please any help
thank you

解决方案

You Have to use .. Proper WebCam Driver dll file and use that dll in your project .. and consume that dll''s methods.


这篇关于拔出&插入USB webCame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆