Printing Attachment On Win32

Printing attachments with Notes is not very comfortable. You can do it with OLE
but you need to know witch software to call.
This way enables you to print using the native software print function.

This function calls a win32 method : ShellExecute;
it looks in the registry what soft is linked to the file to print.

Hope you'll enjoy this.
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(Byval hwnd As Long, Byval lpszOp As String, _
Byval lpszFile As String, Byval lpszParams As String, _
Byval LpszDir As String, Byval FsShowCmd As Long) As Long

Declare Private Function GetDesktopWindow Lib "user32" () As Long

Private Const SW_HIDE = 0&

Sub PrintAttachment(doc As NotesDocument)
Dim rtItem As NotesRichTextItem
Dim Scr_hDC As Long
Dim ret As Long
Dim file As String

Set rtItem = doc.GetFirstItem("D_Body")
If Not rtItem Is Nothing Then
Forall o In rtItem.EmbeddedObjects
file = ReplaceSubString ( o.Name , " " , "_" )
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,
Null ,"c:\temp" ,SW_HIDE)
If ret <= 32 Then
Msgbox "An error occurs while printing!"
End If
End Forall
End If
End Sub
This was first published in November 2000

Dig deeper on Lotus Notes Domino Administration Tools

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

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

SearchVirtualDataCentre.co.UK

Close