从ms-access打开webCam

时间:2015-04-21 15:05:34

标签: vba ms-access webcam capture

我必须打开webCam并从MS-Access拍摄照片,我正在研究,但它是不可能的。 我很感激你给我的任何帮助。

我发现了这个

Private Sub Command11_Click()
    Dim tempfile As String
    Dim mydevice As WIA.Device
    Dim item As WIA.item
    Dim imfile As WIA.imagefile
    Dim Commondialog1 As WIA.CommonDialog

    'put the path and name for the location of your temp file here.
    tempfile = ("C:\Users\Desktop\filename.jpg")

    'the next 4 lines deletes the old temp file if it exists
    Set filesystemobject = CreateObject("Scripting.FileSystemObject")

    If filesystemobject.FileExists(tempfile) Then
        Kill (tempfile)
    End If

    'the next two lines set up the configuration
    Set Commondialog1 = New CommonDialog
    Set mydevice = Commondialog1.ShowSelectDevice

    Set item = mydevice.ExecuteCommand(wiaCommandTakePicture) 'instructs the camera to take the picture
    Set imfile = item.Transfer 'transfers the picture from the camera

    'this line saves the picture to a specified file
    imfile.SaveFile (tempfile)
    'this sets the picture on the form to show the new picture
    Me.OLEUnbound1.Picture = (tempfile)

    MsgBox "Picture taken"

Exit_btnTakePicture_click:
    Set mydevice = Nothing
    Set item = Nothing
    Exit Sub
End Sub

这向我展示了内置摄像头,但我需要使用内置摄像头

如何通过MS Access获取内置的webCam?

0 个答案:

没有答案