专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Windows Mobile

求教怎么在C#中调用 SHCameraCapture接口

发布时间:2010-05-30 01:01:09 文章来源:www.iduyao.cn 采编人员:星星草
求教如何在C#中调用 SHCameraCapture接口
我给酷派f800写一个小东西,由于它是CE6.0的系统无法使用CameraCaptureDialog,但厂家实现了兼容mobile的SHCameraCapture接口。
我按照网上的例子写了一段调用SHCameraCapture的代码结果在ce6.0和mobile6.1上都报NotSupportedException异常,求解,xiexie
C# code

 private void button2_Click(object sender, EventArgs e)
        {
            ShowCamera();
        }
        public struct SHCAMERACAPTURE
        {
            public Int32 cbSize;
            public IntPtr hwndOwner;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
            public string szFile;
            [MarshalAs(UnmanagedType.LPStr)]
            public string pszInitialDir;
            [MarshalAs(UnmanagedType.LPStr)]
            public string pszDefaultFileName;
            [MarshalAs(UnmanagedType.LPStr)]
            public string pszTitle;
            public Int32 StillQuality;
            public Int32 VideoTypes;
            public Int32 nResolutionWidth;
            public Int32 nResolutionHeight;
            public Int32 nVideoTimeLimit;
            public Int32 Mode;
        }
        [DllImport("aygshell.dll")]
        static extern int SHCameraCapture(ref SHCAMERACAPTURE pshcc); 
        private void ShowCamera()
        {
            SHCAMERACAPTURE captureData = new SHCAMERACAPTURE
            {
                cbSize = sizeof(Int64),
                hwndOwner = (IntPtr)0,
                szFile = "\\My Documents",
                pszDefaultFileName = "picture.jpg",
                pszTitle = "Camera Demo",
                StillQuality = 0,
                VideoTypes = 1,
                nResolutionWidth = 480,
                nResolutionHeight = 640,
                nVideoTimeLimit = 0,
                Mode = 0
            };
            SHCameraCapture(ref captureData);
        }








------解决方案--------------------
SHCameraCapture是肯定支持的。
猜测是对SHCameraCapture的封装有问题,导致调用出错。
楼主仔细检查一下,估计是SHCAMERACAPTURE的定义,某个属性有问题。
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: