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

#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;
}

posted on 2010-12-17 11:20 wrh 阅读(1055) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

<2008年10月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

统计

常用链接

留言簿(19)

随笔档案

文章档案

收藏夹

搜索

最新评论

阅读排行榜

评论排行榜