按理说,windows mobile上使用.net cf 有现成的类可用,几行代码搞定:
代码
CameraCaptureDialog cameraCaptureDialog = new CameraCaptureDialog();
if (cameraCaptureDialog.ShowDialog() == DialogResult.OK)
{
Image image = new Bitmap(cameraCaptureDialog.FileName);
this.pictureBox1.Image = image;
}
if (cameraCaptureDialog.ShowDialog() == DialogResult.OK)
{
Image image = new Bitmap(cameraCaptureDialog.FileName);
this.pictureBox1.Image = image;
}
在模拟器上测试通过,可一放到真机上,就不好用,离奇的是,它还导致机器自带的照相程序也不好用了,就得重启机。
.net不行,那就换c++,使用sdk的api, sdk附带的samples中有个CECamera,同样模拟器通过,真机死翘翘!!
还是不行,那就换更低一级的api,使用DirectShow,例子也有现成的:CameraCapture;可是结果还是一样的!!!
这下,我真的郁闷了~~~~
测试项目:MobileCamera.zip