الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

كيف يمكن إستدعاء السكانر من ال VB.NET ؟

بدأه حمزة في 6 يوليو 2004 · 8 رد · 8,031 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

كيف يمكن إستدعاء السكانر من داخل ال VB.net?

اقتباس
How to get experience without a job, and how to get a job without experience
#2

This article may help you

رأس الحكمة الإيمان بالله

#3

شكراً أخ abdelaleem, لكن الكود مكتوب بلغة C#.

طلبي هو بلغة ال VB.net لو سمحت.

مع الشكر الجزيل....

اقتباس
How to get experience without a job, and how to get a job without experience
#4

الفررقات بين اللغتين بسيطة ، تتراوح ما بين علامة semicolon في آخر السطر الغير موجودة في الفجوال بيسك ، وصيغة if و صيغ الحلقات التكرارية loops.

مرفق ملف يحتوي على الفروقات وأوجه الشبه بين اللغتين.

OReilly - C Sharp and VB.NET Conversion Pocket Reference.zip

تم تعديل هذه المشاركة بواسطة walcom في 7 يوليو 2004 في 00:18

فكر بطريقة أخرى

#5

شكراً walcom و abdelaleem للإهتمام بالموضوع. فأنا بحاجة إلى هذا الكود للضرورة. وشكراً للأخ walcom على الكتاب الرائع...

لكن مع الآسف تغيير الكود من C# إلى VB.NET لم ينجح... فإذا أمكن مساعدة جديدة لكن هذه المرة بال VB.NET لو سمحتم

اقتباس
How to get experience without a job, and how to get a job without experience
#6

Ok, I've converted the most important piece, but I didn't test it

You must first add a reference to the component "Microsoft Windows Image Acquisition 1.01 Type Library" (wiascr.dll)

then copy & paste the contents of this class

Imports System.IO
Imports System.Runtime.InteropServices

'namespace of imported WIA Scripting COM component
Imports WIALib

Public Class VBWia
    'create COM instance of WIA manager
    Dim WiaManager As New WIALib.WiaClass()

    Dim selectUsingUI As Object = System.Reflection.Missing.Value

    'let user select device
    Dim wiaRoot As ItemClass = WiaManager.Create(selectUsingUI)

    ' this call shows the common WIA dialog to let 
    'the user select a picture:
    Dim wiaPics As CollectionClass = wiaRoot.GetItemsFromUI(WiaFlag.SingleImage, WiaIntent.ImageTypeColor)

    'enumerate all the pictures the user selected
    Public Sub EnumeratePics()
        Dim wiaObj As Object
        Dim typeItem As ItemClass
        For Each wiaObj In wiaPics
            Dim wiaItem As ItemClass = Marshal.CreateWrapperOfType(wiaObj, typeItem.GetType)
            'create temporary file for image
            Dim imageFileName As String = Path.GetTempFileName
            'transfer picture to our temporary file
            wiaItem.Transfer(imageFileName, False)

        Next
    End Sub
End Class

The part that I didn't translate is the code for notify the application about the completed transfer

:) so try first the code I posted, if it worked then I'll try to translate the rest, however I'm not sure about the translated code

Hope that helps

رأس الحكمة الإيمان بالله

#7

Ok, Forget about my vb.net translation :) , I've found the translated one, as well as it's translated by the same author of the original one

I've found the whole solution by the chance within Code Liberary for .Net

I assume that it's working well, althoug I coudn't test because i don't have a scanner

See the attached file

Hope that helps

Mohammed Abdel-Aleem

Twain_Scan.zip

رأس الحكمة الإيمان بالله

#8

أكثر من رائع وجزاك الله خيرا

لكن عندما اختار من قائمة File الأمر Acquire

سوف تظهر نافذة الماسح الضوئي وعندها إذا ضغطت cancel أو ضغطت على مفتاح الهروب Esc سوف يتجمد البرنامج بالكلية

عدا ذلك البرنامج يعمل بشكل ممتاز

أيضاً لدي فكرة أود تنفيذها وهي أن أحفظ هذه الصورة بامتداد PDF فهناك أجهزة مسح ضوئي تمسح المستندات بسرعة آلة تصوير المستندات وتقوم بالحفظ على الهاردسك الداخلي لديها بامتداد PDF.

فهل أستطيع الحفظ بامتداد PDF?

مواضيع مشابهة