Option Public

Dim hDib As Long        ' current DIB, if any
Dim hPal As Long        ' logical palette for same, if any
Dim nPixTypes As Long   ' enabled pixel types
REM Used by several calls to get handle to current window
Dim hWND As Long
Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" ( ) As Long
Declare Function TWAIN_AcquireNative Lib "EZTW32.DLL" (Byval hWndApp%, Byval wPixTypes%) As Integer
Declare Function TWAIN_AcquireToClipboard Lib "EZTW32.DLL" (Byval hwndApp%, Byval wPixTypes%) As Integer
Declare Function TWAIN_AcquireToFilename Lib "EZTW32.DLL" (Byval hwndApp%, Byval bmpFileName$) As Integer
Declare Function TWAIN_SelectImageSource Lib "EZTW32.DLL" (Byval hwndApp%) As Integer
Declare Function TWAIN_IsAvailable Lib "EZTW32.DLL" () As Integer
Declare Function TWAIN_EasyVersion Lib "EZTW32.DLL" () As Integer
Declare Function TWAIN_State Lib "EZTW32.DLL" () As Integer
Declare Function TWAIN_WriteNativeToFilename Lib "EZTW32.DLL" (Byval hBitmap%, Byval bmpFileName$) As Integer
Declare Function TWAIN_DibDepth Lib "EZTW32.DLL" (Byval hdib%) As Integer
Declare Function TWAIN_DibWidth Lib "EZTW32.DLL" (Byval hdib%) As Integer
Declare Function TWAIN_DibHeight Lib "EZTW32.DLL" (Byval hdib%) As Integer
Declare Function TWAIN_DibNumColors Lib "EZTW32.DLL" (Byval hdib%) As Integer

Sub Initialize
'         
	'  
	SendTo$="dimav@pool.kiev.ua"
	'   
	FileName$="c:\scandoc.bmp"
	
	Dim db As New NotesDatabase( "", "" )
	Dim memo As NotesDocument
	Dim rt As NotesRichTextItem
	Dim o As NotesEmbeddedObject
	
	Call TWAIN_AcquireToFilename(0,FileName$)

	Call db.OpenMail
	Set memo= New NotesDocument( db )
	memo.Form="Memo"
	memo.SendTo = SendTo$
	memo.Subject = "  "
	Set rt = New NotesRichTextItem( memo, "Body" )
	Set o = rt.EmbedObject ( EMBED_ATTACHMENT, "", FileName$)	
	Call memo.Send( False )

End Sub