首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Windows Mobile >

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

2012-03-25 
求教如何在C#中调用 SHCameraCapture接口我给酷派f800写一个小东西,由于它是CE6.0的系统无法使用CameraCap

求教如何在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的定义,某个属性有问题。

热点排行