We can launch the camera and capture photos in the windows enabled mobile phone using dot net in built libraries.
You need to import "Microsoft.WindowsMobile.Forms" libraries which can be found when you install "Windows Mobile 6 SDK" under the folder "Windows Mobile 6 SDK\Managed Libraries".
The copy the below code in any button event.
Dim cameraimgfolder As String = "\My Documents\pictures"
Dim objImage As System.Drawing.Image
Dim MycameraDialog As New CameraCaptureDialog()
MycameraDialog .Owner = Me
MycameraDialog .Title = "Take Still Picture"
MycameraDialog .Mode = CameraCaptureMode.Still
MycameraDialog .StillQuality = CameraCaptureStillQuality.Normal
MycameraDialog .InitialDirectory = cameraimgfolder
If ((MycameraDialog .ShowDialog() <> DialogResult.OK) _
Or (MycameraDialog .FileName = "")) Then
' Handle the cancel case here.
MycameraDialog .DefaultFileName = "XXXXX"
MycameraDialog .InitialDirectory = cameraimgfolder
End If
' we need to know the file name as it will be created automatically
TextBox3.Text = cameraDialog.FileName
filePath = TextBox3.Text
Dim picturenamearr() As String
picturenamearr = filePath.Split("\")
filename = picturenamearr.Last
If TextBox3.Text.Trim <> "" Then
'storing in image object; so that you can place the object in the picture box if you need
objImage = New Bitmap(TextBox3.Text.ToString)
End If
Notes:
After the image has been captured based on the device it will automatically jumps to the initiated screen or else it will show you back button.
Tuesday, November 24, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment