Question

I want to show the image that mobile phone's camera its taking on a control in a WinForm. The idea is that my application works like camera's program. I want to show the image like if the user is going to take a photo.

How can I do that? Can I do that?

If you need more details ask me.

Thank you!

Was it helpful?

Solution

Not very sure what you need, but you may try using Microsoft.WindowsMobile.Forms.CameraCaptureDialog:

    string originalFileName;
    using (CameraCaptureDialog dlg = new CameraCaptureDialog()) {
        dlg.Mode = CameraCaptureMode.Still;
        dlg.StillQuality = CameraCaptureStillQuality.Low;
        //dlg.Resolution = new Size(800, 600);
        dlg.Title = "Take the picture";
        DialogResult res;
        try {
            res = dlg.ShowDialog();
        }
        catch (Exception ex) {
            Trace.WriteLine(ex);
            return null;
        }

        if (res != DialogResult.OK)
            return null;
        this.Refresh();
        originalFileName = pictureFileName = dlg.FileName;
    }

Later Edit: Some of you might find useful this link, too: http://community.intermec.com/t5/General-Development-Developer/CN50-MS-Camera-Capture-Dialog-generates-error/m-p/12881#M4083

OTHER TIPS

What you want is a preview, not the capture, which is far more difficult. The best (and maybe only) solution is to insert a DShow Filter into the filtergraph to pipe the preview window to where you want.

COM is a bear in the Compact Framework, and DShow is tough no matter what platform you're on. There are some resources online, like the DShow.NET library at sourceforge, and Alex Mogurenko's blog, but nothing specific to creating a capture.

There is a native capture sample in the WinMo SDK that would be a useful guide to getting you there.

I think you should program against the hardware directly using a sdk or something similar.

Since programming against hardware directly is usually in c/c++ the sdk will probably be native. So either you probably have to use pinvoke and the unsafe keyword.

But first you should find the way to access the camera, and since this is hardware dependant you can start on the website of the phone's manufacturere.

Check SmartDeviceFramework from OpenNetCF.org have some tools for PocketPC including capturing frames from Camera.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top