 |
|
รบกวนหน่อยครับ พอดี อยากทราบ โค๊ด Scanning เอกสาร ลงเครื่อง โดย save ไปที่ PartFlie ที่กำหนดใว้ |
|
 |
|
|
 |
 |
|
ติดปัญหาตรงไหนครับ
|
 |
 |
 |
 |
Date :
2017-04-13 14:53:29 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
สแกน จากสแกนเนอร์ ใช้ WIA ครับ
Code (VB.NET)
Imports WIA
Imports System.IO
Code (VB.NET)
Try
Dim CD As New WIA.CommonDialog
Dim F As WIA.ImageFile = CD.ShowAcquireImage(WIA.WiaDeviceType.ScannerDeviceType, WiaImageIntent.ColorIntent, WiaImageBias.MinimizeSize, , True, True)
If F IsNot Nothing Then
Dim MStream As IO.MemoryStream = Nothing
Try
'Convert the raw scanner output into a byte array
Dim ImgBytes() As Byte = DirectCast(F.FileData.BinaryData, Byte())
'Read the image data bytes into a MemoryStream
MStream = New IO.MemoryStream(ImgBytes)
'Write Bytes To Local Disk
File.WriteAllBytes("d:\test.jpg", MStream.ToArray)
Catch ex As Exception
MsgBox("ผิดพลาด : " & ex.Message)
End Try
If MStream IsNot Nothing Then MStream.Dispose()
End If
Catch ex As Exception
Select Case _WiaErrCode(ex.Message)
Case "0x80210015" '// No device detected.
msgStr = "ไม่พบอุปกรณ์สำหรับสแกนรูปภาพ "
msgStr &= "ตรวจสอบให้แน่ใจว่าอุปกรณ์สแกน ได้ติดตั้งแล้ว เสียบสายต่อเข้าคอมพิวเตอร์และเปิดอุปกรณ์สแกนแล้ว"
MessageBox.Show(Me, msgStr, "ไม่พบอุปกรณ์", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Case "0x80210064" '// Cancel was pressed
Case Else
MessageBox.Show(Me, "Error: " & ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Select
End Try
WIA หาได้จาก COM type

|
ประวัติการแก้ไข 2017-04-13 17:06:56 2017-04-13 17:09:35
 |
 |
 |
 |
Date :
2017-04-13 17:04:14 |
By :
pakyaudio |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|