Scan image with TWAIN scanner and insert into Rich Text (R5/Win32)

The following solution uses the Kodak (former Wang) imaging control that comes with Win32 to perform a customized image scan and insertion. 1. In form design mode place the control on your form by choosing 'Create/Object' from the menu. In the Create Object dialog select the 'Control' radio button and select the Kodak scan imaging control (e.g. filename= C:WINNTsystem32ImgScan.ocx) from the list. Select the control and press Alt-Enter. Name the object as 'objScan' (w/o the quotes). Hide if: @True (always).
2. Be sure to have a rich text field named 'Body' (w/o the quotes) inserted in your form.
3. Insert a command button into another paragraph of your form design, label it 'Scan' (w/o the quotes). Tell the button to hide exept in edit mode.
Ack.: - further information about additional controls, scanning parameters aso is in IMGOCXD.HLP that ships with the control
- imaging control is also available at www.eastmansoftware.com
- I can recommend the following settingsfor invoices, receipts...: (JPEG), compressed filesize, 100 dpi resolution, b/w settings
- you can change the Const declarations in the code to meet your special needs, image formats and directory permissions
- if you don't like a button, use an action instead
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 
This was last published in March 2001

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close