zoukankan      html  css  js  c++  java
  • Scan image with TWAIN scanner and insert into Rich Text (R5/Win32)

    This is the button's LS code:
    Declare Function GetActiveWindow Lib {User32} () As Long
    Declare Sub SetActiveWindow Lib {User32} (Byval hwnd As Long)

    Sub Click(Source As Button)
    '**********
    'Scan image with TWAIN scanner and insert into Rich Text (R5/Win32)
    'written by Dipl. Ing. Wolfgang Flamme (wflamme@mainz-online.de), 2001-03-23
    '**********
    On Error Goto ErrorHandler
    Const SCANFILEPATH$={C:Tempscan.jpg}
    Const IMPORTFILETYPE$={JPEG}
    Const RTFNAME$={Body}
    Const SCANOBJNAME$={objScan}

    Dim ws As New NotesUIWorkspace
    Dim uidoc As NotesUIDocument
    Dim wndhnd As Long
    Dim strFile As String
    Dim strRTFName As String
    Dim objScan As Variant

    Set uidoc = ws.CurrentDocument
    Set objScan = uidoc.GetObject(SCANOBJNAME)

    wndhnd&=GetActiveWindow()

    If objScan.ScannerAvailable=True Then
    objScan.ShowSelectScanner

    objScan.Image=SCANFILEPATH
    objScan.ScanTo=2 'StoreOnly
    objScan.PageOption=6 'CreateReplace
    objScan.ShowSetupBeforeScan=True 'ShowScanDialog
    Call objScan.ShowScanPreferences 'ShowScanQualityDialog
    Call objScan.StartScan
    Call uidoc.GotoField(RTFNAME)
    Call uidoc.import(IMPORTFILETYPE, SCANFILEPATH)
    Call objScan.CloseScanner
    Call SetActiveWindow(wndhnd&)
    Else
    Msgbox {Error: TWAIN driver not found!}
    End If

    TheEnd:
    Exit Sub

    ErrorHandler:
    Messagebox {The following unexpected error has occured: } & Trim$(Str(Err)) & {: } & Error$, 0+48+0+0, {Error Message..}

    Resume TheEnd
    End Sub


  • 相关阅读:
    extjs 为组件动态添加插件
    springboot使用spring-cloud-starter-alibaba-sentinel导致响应变成xml格式
    js 将数据保存到本地
    iframe跨域安全
    nginx url自动301加斜杠
    EXTJS防止表单中回车触发提交
    servlet
    Struts1和Struts2的区别
    AWT和Swing的简记
    sleep()和wait()
  • 原文地址:https://www.cnblogs.com/hannover/p/2223324.html
Copyright © 2011-2022 走看看