首页 > 其他 > 详细

VC 检测计算机是否安装有摄像头

时间:2019-01-01 10:07:34      阅读:151      评论:0      收藏:0      [点我收藏+]
#include <windows.h>
#include <stdio.h>
#include <iostream.h>
#include "vfw.h"
#pragma comment( lib, "vfw32.lib" )

void main()
{
   
    char strDeviceVersion[80];    //设备版本信息
    char strDeviceAndVersion[160];  //设备名和版本信息
    int nIndex;
    int nDriverCount = 0;                //支持的设备驱动程序个数
   
   
    for(nIndex=0; nIndex <9; nIndex++) 
    { 
        if(capGetDriverDescription(nIndex,(LPSTR)strDeviceAndVersion,sizeof(strDeviceAndVersion),(LPSTR)strDeviceVersion,sizeof(strDeviceVersion))) 
        { 
            strcat(strDeviceAndVersion,","); 
            strcat(strDeviceAndVersion,strDeviceVersion); 
            nDriverCount++;                  //得到vfw设备信息及连的设备数量
        } 
        else 
            break; 
    } 
    if (nDriverCount==0)
        cout <<"没有摄像头"<<endl; 
    else
        cout <<"有摄像头"<<endl; 
}

 

VC 检测计算机是否安装有摄像头

原文:https://www.cnblogs.com/daggex/p/10204055.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!