Search code examples
compact-frameworkpowerpc

ES400: CameraCaptureDialog error after saving one image


I am getting an error using the CameraCaptureDialog class in the ES400, while catpturing the second image it says "Could not find image". But the same code works fine in MC35.

  Dim app_path As String
        Dim ccd As New CameraCaptureDialog
        Dim count As Integer
        count = TransImagelst.Images.Count
        Try

            ccd.Owner = Me
            ccd.DefaultFileName = "Image" & count.ToString & ".jpg"
            ccd.Mode = CameraCaptureMode.Still
            ccd.StillQuality = CameraCaptureStillQuality.Low
            ccd.Resolution = New Size(0, 0)
            ccd.Title = "Image"
            ccd.InitialDirectory = DataBase_Path & "\" & Region & "\Image"
            ccd.ShowDialog()


            'add files to image directory.
            If Not Directory.Exists(DataBase_Path & "\" & Region & "\Image") Then Directory.CreateDirectory(DataBase_Path & "\" & Region & "\Image")

            If ccd.FileName  String.Empty Then
                TransImagelst.ImageSize = New Drawing.Size(55, 55)
                TransImagelst.Images.Add(New Bitmap(ccd.FileName))
                TransImagelstv.View = View.LargeIcon
                TransImagelstv.LargeImageList = TransImagelst
                Dim lv As New ListViewItem("Image" & TransImagelst.Images.Count - 1)
                TransImagelstv.Items.Add(lv)
                lv.ImageIndex = TransImagelst.Images.Count - 1
            End If

Please help me out.


Solution

  • I had the same problem. Although ES400 is stuffed with features, it does not work with the Cameracapturedialog. It does not even support the Imaging library in the Motorla EMDK SDK. This is baffeling. The EMDK Programmers Guide has an ES400 Programming entry which states - You must use Microsoft’s DirectShow for capturing images. I tried this approach, but I could only get VGA resolution which is rubbish for my purpose. If this is sufficient for you, you might have a look at http://alexmogurenko.com/blog/directshownetcf/. I am extremely disappointed of the ES400 on this point. I ended up using a simple soliution that is a bit rubbish, but at least it works (see outline below and good luck).

    using (Process proc = new Process())
    {
        //This will open the internal camera application.
        proc.StartInfo = new System.Diagnostics.ProcessStartInfo(@"\Windows\Camera.lnk", string.Empty);
        if (proc.Start() == false)
        {
          Messagebox.(this did not work blablabla)
            return; 
        }
    }
    //The camera app has now focus, in the meantime, we wait with a new messagebox…
    Messagebox.Show(“Ok,Cancel” to open picturedialog)
    if (cancel)
        return;
    string _filename = string.Empty; 
    using (SelectPictureDialog _spd = new SelectPictureDialog())
    {
        _spd.Owner = this;
        _spd.CameraAccess = false;
        _spd.LockDirectory = false;
        _spd.SortOrder = SortOrder.DateDescending;
        _spd.Title = "Select picture from camera";
        if (_spd.ShowDialog() == DialogResult.OK)
        {
            _filename = _spd.FileName;
        }
        else //No picture selected
            return;
    }
    
    //Handle image.. 
    //Delete image from folder?