Capture multiple images from webcam

BenBrazil

New member
Joined
Mar 17, 2009
Messages
1
Programming Experience
3-5
Hi,

I am using Visual Studio 2005, .Net 2.

I am writing a VB.NET application which captures an image from a webcam and saves it as a jpeg. I have a button which captures the image and successfully saves the image. However when I click the button again to save the image as the same file I get the following GDI error:

"A generic error occurred in GDI+."

This is the code I am using

VB.NET:
 Dim data As IDataObject
        Dim bmap As Image
        
        SendMessage(hHwnd, WM_CAP_EDIT_COPY, 0, 0)

        data = Clipboard.GetDataObject()

        If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
            bmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Image)
            picCapture.Image = bmap
            ClosePreviewWindow()
            bmap.Save("C:\image.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
        End If


What do I need to do to save the image again as the same file in the same location?
Any help with this would be most welcome.

Thanks,

Ben
 

Latest posts

Back
Top