Chinaunix首页 | 论坛 | 博客
  • 博客访问: 569331
  • 博文数量: 1357
  • 博客积分: 3000
  • 博客等级: 中校
  • 技术积分: 14950
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-14 20:23
文章分类

全部博文(1357)

文章存档

2010年(1357)

我的朋友

分类:

2010-11-01 14:07:13

  使用shcameracapture接口可以调出照相机进行拍照、摄像,并得到图片或视频文件的路径。   以下代码进行拍照: shcameracapture shcc; zeromemory(&shcc, sizeof(shcc)); shcc.cbsize       = sizeof(shcc); shcc.hwndowner     = null; shcc.pszinitialdir   = null; shcc.pszdefaultfilename = null; shcc.psztitle      = null; shcc.stillquality    = cameracapture_stillquality_default; shcc.videotypes     = cameracapture_videotype_all; shcc.nresolutionwidth  = 0; shcc.nresolutionheight = 0; shcc.nvideotimelimit  = 0; shcc.mode        = cameracapture_mode_still;    hresult hreturn = shcameracapture(&shcc);   如果hreturn为s_ok,则表示拍照成功,shcc.szfile即为文件名称(包含路径)。shcc.pszinitialdir和shcc.pszdefaultfilename可以设置保存路径和默认文件名。shcc.hwndowner如果使用了不同的窗体,可能会有问题。   如果要进行摄像,有些参数需进行调整,如下 shcc.stillquality    = cameracapture_stillquality_normal; shcc.videotypes     = cameracapture_videotype_standard; shcc.nresolutionwidth  = 640; shcc.nresolutionheight = 480; shcc.mode        = cameracapture_mode_videowithaudio;   这些参数涉及到几个枚举变量,我们来看看: typedef enum {   cameracapture_mode_still = 0,   cameracapture_mode_videoonly,   cameracapture_mode_videowithaudio, } cameracapture_mode;   cameracapture_mode_still对应照片,cameracapture_mode_videoonly对应无声视频,cameracapture_mode_videowithaudio对应有声视频。 typedef enum {   cameracapture_stillquality_default = 0,   cameracapture_stillquality_low,   cameracapture_stillquality_normal,   cameracapture_stillquality_high, } cameracapture_stillquality;   对应图片和视频清晰度。 typedef enum {   cameracapture_videotype_all = 0xffff,   cameracapture_videotype_standard = 1,   cameracapture_videotype_messaging = 2, } cameracapture_videotypes;   cameracapture_videotype_all对应照片,cameracapture_videotype_standard对应wmv视频,cameracapture_videotype_messaging对应mms视频。当使用后两个值时,shcc的nresolutionwidth和nresolutionheight成员均不能为零。一般是640x480。   很遗憾,这个接口只能在wm5.0以上使用。wm2003上没有统一摄像头标准,硬件厂商各做各的,只能跟硬件厂商询问调用方法。 如果喜欢windows mobile上调用摄像头接口请收藏或告诉您的好朋友.
阅读(179) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~