اذهب الي المحتوي
أوفيسنا

تحديد الاسكانر المستخدم من اكثر من سكانر متصل


إذهب إلى أفضل إجابة Solved by Barna,

الردود الموصى بها

الاخوة الافاضل استخدم الكود الحالي لمسح الصور 
واحتاج ان اضيف زر منفصل لاختيار الاسكانر المستخدم من بين اكثر من سكانر متصل
 

Private Sub cmdScan1_Click()

'==========================

On Error Resume Next
If IsNull(fileno) Or fileno = "" Then
        DoCmd.OpenForm "frmMassage"
        Forms!frmMassage!lblMassage.Caption = " ÝÖáÇð íÌÈ Ãä ÊÞæã ÈÅÏÎÇá ÑÞã ÇáãáÝ ÍÊì ÊÊãßä ãä ÅÖÇÝÉ ÕæÑÉ ÇáÚÖæ "
        Me.fileno.SetFocus
Else

Dim fdialog As Office.FileDialog
Dim filepath As String
Dim sdialog As New WIA.CommonDialog
Dim imagefile As WIA.imagefile
On Error GoTo errorhandle

Dim fso As Object
Dim fldrname, fldrpath, FoldrPath As String
FoldrPath = "images_waad" & "\case_Photo"
Set fso = CreateObject("scripting.filesystemobject")
          fldrpath = CurrentProject.Path & "\" & FoldrPath
          If Not fso.FolderExists(fldrpath) Then
             fso.createfolder (fldrpath)
          End If

'==================================
Set fdialog = Application.FileDialog(msoFileDialogSaveAs)
filepath = CurrentProject.Path & "\" & FoldrPath & "\" & Me.fileno & ".jpg"
            Set imagefile = sdialog.ShowAcquireImage()
            imagefile.SaveFile filepath
            PicPath = filepath
            Image.Requery

errorhandleexit:
        Exit Sub
errorhandle:
If Err.Number = "-2147024816" Then
If MsgBox("ÊæÌÏ ÕæÑÉ ÊÍãá äÝÓ ÇáÑÞã" & vbNewLine & "åá ÊÑíÏ ÍÐÝ ÇáÕæÑÉ ÇáÞÏíãÉ" & vbNewLine & "Ýí ÍÇá ÇáÑÝÖ ÓíÊã ÇÖÇÝÉ ÑÞã ÚÔæÇÆí Çáì ÇÓã ÇáÕæÑÉ áÊãííÒåÇ", vbCritical + vbYesNo + vbMsgBoxRight, "ÊäÈíå") = vbYes Then
Kill filepath
            'Set imagefile = sdialog.ShowAcquireImage()
            imagefile.SaveFile filepath
            PicPath = filepath
            
            FoldrPath = "images_waad" & "\case_Photo"
            filepath = CurrentProject.Path & "\" & FoldrPath & "\" & Me.fileno & ".jpg"
            Me.Image.Picture = filepath
            
            
            Image.Requery
Else
Dim g As String
g = CurrentProject.Path & "\" & FoldrPath & "\" & Me.fileno & "-" & Format(Now, "hhnnss") & ".jpg"
            imagefile.SaveFile g
            PicPath = g
            Image.Requery


End If
ElseIf Err.Number = "-2145320939" Then
MsgBox "ÇáÇÓßÇäÑ ÛíÑ ãÊÕá", vbCritical + vbMsgBoxRight, "ÊäÈíå"
Else
        PicPath = Err.Number
        MsgBox Err.Description

End If
        Resume errorhandleexit
End If
FoldrPath = "images_waad" & "\case_Photo"
filepath = CurrentProject.Path & "\" & FoldrPath & "\" & Me.fileno & ".jpg"
Me.Image.Picture = filepath
Image.Requery
End Sub

 

رابط هذا التعليق
شارك

  • أفضل إجابة

للاسف ليس لدي سكنر ... جرب واعلمنا ..........

Public Function SelectScanner()
    Dim ComDialog As New WIA.CommonDialog
    Dim wiaScanner As WIA.Device

    ' عرض نافذة لاختيار الجهاز
    Set wiaScanner = ComDialog.ShowSelectDevice(WiaDeviceType.ScannerDeviceType, False, True)

    ' إذا تم اختيار جهاز، فإن DeviceID سيحتوي على معرف الجهاز المحدد
    If Not wiaScanner Is Nothing Then
        MsgBox "تم اختيار الجهاز: " & wiaScanner.DeviceID
    Else
        MsgBox "لم يتم اختيار أي جهاز."
    End If
End Function

يتطلب إضافة مرجع إلى “Microsoft Windows Image Acquisition Library v2.0

  • Like 2
رابط هذا التعليق
شارك

29 minutes ago, Barna said:

للاسف ليس لدي سكنر ... جرب واعلمنا ..........

Public Function SelectScanner()
    Dim ComDialog As New WIA.CommonDialog
    Dim wiaScanner As WIA.Device

    ' عرض نافذة لاختيار الجهاز
    Set wiaScanner = ComDialog.ShowSelectDevice(WiaDeviceType.ScannerDeviceType, False, True)

    ' إذا تم اختيار جهاز، فإن DeviceID سيحتوي على معرف الجهاز المحدد
    If Not wiaScanner Is Nothing Then
        MsgBox "تم اختيار الجهاز: " & wiaScanner.DeviceID
    Else
        MsgBox "لم يتم اختيار أي جهاز."
    End If
End Function

يتطلب إضافة مرجع إلى “Microsoft Windows Image Acquisition Library v2.0

 

 ناجحة ولكن زودني بكود استدعاء مناسب ربما يكون افضل  من هذا

Private Sub Command190_Click()
'TWAIN_SelectImageSource (Me.hwnd)

Dim strScannerName As String

strScannerName = SelectScanner()

If strScannerName <> "" Then

    ' Start the scanning process
    ' ...

Else

    MsgBox "No TWAIN scanner found."

End If

End Sub

 

رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information