如何判断一个摄像头已经被使用啊?

lwg7603 2004-10-10 03:26:59
现在正在做一个视频聊天的东东,用微软的video capture api捕获视频数据(不用DirectX),现在发现一个问题,就是别的程序已经占用摄像头的时候,运行我的程序会弹出一个"视频源"的对话框,很烦,能不能在程序中判断出摄像头已经被占用啊,我看了所有API,没有找到方法,求各位帮我~~~~万分感谢!!!!!
...全文
404 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
醉马不肖 2004-10-19
  • 打赏
  • 举报
回复
你是在说连接capDriverConnect是有对话框马?
如果不是你可以试试capDriverConnect这个函数
Mr-Chen 2004-10-19
  • 打赏
  • 举报
回复
用DeviceIoControl判断
taianmonkey 2004-10-19
  • 打赏
  • 举报
回复
you can get the parameter fCaptureInitialized to detect whether the capture device is using or not!
taianmonkey 2004-10-19
  • 打赏
  • 举报
回复
CAPDRIVERCAPS
The CAPDRIVERCAPS structure defines the capabilities of the capture driver.

An application should use the WM_CAP_DRIVER_GET_CAPS message or capDriverGetCaps macro to place a copy of the driver capabilities in a CAPDRIVERCAPS structure whenever the application connects a capture window to a capture driver.

typedef struct {
UINT wDeviceIndex;
BOOL fHasOverlay;
BOOL fHasDlgVideoSource;
BOOL fHasDlgVideoFormat;
BOOL fHasDlgVideoDisplay;
BOOL fCaptureInitialized;
BOOL fDriverSuppliesPalettes;
HANDLE hVideoIn;
HANDLE hVideoOut;
HANDLE hVideoExtIn;
HANDLE hVideoExtOut;
} CAPDRIVERCAPS;

Members
wDeviceIndex
Index of the capture driver. An index value can range from 0 to 9.
fHasOverlay
Video-overlay flag. The value of this member is TRUE if the device supports video overlay.
fHasDlgVideoSource
Video source dialog flag. The value of this member is TRUE if the device supports a dialog box for selecting and controlling the video source.
fHasDlgVideoFormat
Video format dialog flag. The value of this member is TRUE if the device supports a dialog box for selecting the video format.
fHasDlgVideoDisplay
Video display dialog flag. The value of this member is TRUE if the device supports a dialog box for controlling the redisplay of video from the capture frame buffer.
fCaptureInitialized
Capture initialization flag. The value of this member is TRUE if a capture device has been successfully connected.
fDriverSuppliesPalettes
Driver palette flag. The value of this member is TRUE if the driver can create palettes.
hVideoIn
Not used in Win32 applications.
hVideoOut
Not used in Win32 applications.
hVideoExtIn
Not used in Win32 applications.
hVideoExtOut
Not used in Win32 applications.
taianmonkey 2004-10-19
  • 打赏
  • 举报
回复
capDriverGetCaps
lwg7603 2004-10-19
  • 打赏
  • 举报
回复
如果摄像头已经被占用,只要调用capDriverConnect就会弹出这个对话框~~~
lwg7603 2004-10-19
  • 打赏
  • 举报
回复
to pepsi1980:
不是修改,而是不让他弹出~~~~~~~~

pepsi1980 2004-10-14
  • 打赏
  • 举报
回复
弹出一个"视频源"的对话框,你自己修改一下这个对话框???
ACuke 2004-10-11
  • 打赏
  • 举报
回复
如果被别人占用,你再打开应该有个消息提示吧??
roger_ding 2004-10-11
  • 打赏
  • 举报
回复
DirectX里应该有检测的函数
nwpulipeng 2004-10-10
  • 打赏
  • 举报
回复
帮顶混分
DentistryDoctor 2004-10-10
  • 打赏
  • 举报
回复
你自己尝试一下capDriverConnect,看是否会成功。
lwg7603 2004-10-10
  • 打赏
  • 举报
回复
没人知道吗?
RomanticProgrammer 2004-10-10
  • 打赏
  • 举报
回复
关注!

2,640

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 硬件/系统
社区管理员
  • 硬件/系统社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧