当前位置: 代码迷 >> Windows Mobile >> 求教怎么在C#中调用 SHCameraCapture接口
  详细解决方案

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

热度:413   发布时间:2016-04-25 08:05:38.0
求教如何在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的定义,某个属性有问题。
  相关解决方案