طير البحر قام بنشر مارس 3 مشاركة قام بنشر مارس 3 الاخوة الافاضل استخدم الكود الحالي لمسح الصور واحتاج ان اضيف زر منفصل لاختيار الاسكانر المستخدم من بين اكثر من سكانر متصل 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 رابط هذا التعليق شارك More sharing options...
Foksh قام بنشر مارس 3 مشاركة قام بنشر مارس 3 راجع هذا الرابط ، بعد تجربتي له يعطيك اختيار اسم السكانر ( حسب ما اذكر ) رابط هذا التعليق شارك More sharing options...
أفضل إجابة Barna قام بنشر مارس 3 أفضل إجابة مشاركة قام بنشر مارس 3 للاسف ليس لدي سكنر ... جرب واعلمنا .......... 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 2 رابط هذا التعليق شارك More sharing options...
طير البحر قام بنشر مارس 3 الكاتب مشاركة قام بنشر مارس 3 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 رابط هذا التعليق شارك More sharing options...
Foksh قام بنشر مارس 3 مشاركة قام بنشر مارس 3 مشاركه مع الاستاذ @Barna في حدث عند النقر للزر SelectScanner رابط هذا التعليق شارك More sharing options...
الردود الموصى بها
من فضلك سجل دخول لتتمكن من التعليق
ستتمكن من اضافه تعليقات بعد التسجيل
سجل دخولك الان