Trying to use wiaCommandTakePicture to take real time still picture from a Web Cam.  But got black image only.

HL1208 used Ask the Experts™
I am trying to use wiaCommandTakePicture in WIA to take a picture by Web Cam.  I always got black image.  My source code is below.  Please help!
Dim dc 'As DeviceCommand
Dim itm 'As Item
Dim oImage
For Each dc In dev.Commands
        If dc.CommandID = wiaCommandTakePicture Then 
                Set itm = dev.ExecuteCommand(wiaCommandTakePicture)
                Set oImage = itm.Transfer
                If oImage.FormatID <> wiaFormatJPEG Then
                        Dim IP 'As New ImageProcess
                        Set IP = CreateObject( "Wia.ImageProcess" )
                        IP.Filters.Add IP.FilterInfos("Convert").FilterID
                        IP.Filters(1).Properties("FormatID").Value = wiaFormatJPEG
                        Set oImage = IP.Apply(Img)
                        MsgBox "I have been here - 6" 'this is for debug
                End If
                oImage.SaveFile "C:\Logitech Webcam\wia_image_test_5.jpg"         
        End If

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
My source code is good.  Just need to get a good Web Cam.  I recommend to get a Creative Live Cam Optia AF.  It is fully compitable with Microsoft WIA.  The picture is very clear.  The price is below $60.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial