Calling RJS Image Document Viewer from VB, VB.Net or VBScript to View an Image Document - Support

Calling RJS Image Document Viewer from VB, VB.Net or VBScript to View an Image Document

From Support

Jump to: navigation, search

Listed below is a sample subroutine that can be called from VB, VB.Net or VBScripting to View a Document Image File with the RJS Document Imaging Viewer.

Sub ViewDocument(sDocFile As String, lcWait As Long)

Dim objView As Object  'Viewer object
Dim rtn As Long

'**********************************************************
'Load RJS Doc Viewer Object
'**********************************************************
Set objView = CreateObject("RJSDocumentImaging.CLSRJSDocImage")

'**********************************************************
'Close Program on Exiting Flag
'0 = Do not close program on exiting. Leave Open
'    Note: use when setting lcWait to 0. This is the same
'    as launching the image and returning to user right away.
'    Note: If this setting is used, also make sure to set the
'    HideForm Property to 0. We cannot hide form when not waiting
'    for viewer to exit otherwise the program is left invisible
'    in memory and we have to kill the process via task manager.
'    This is not desirable :-)
'1=  Close program when user exits.
'
'    Default value = 1
'**********************************************************


'**********************************************************
'Hide Form on Exiting Flag
'0 = Do not hide form. See notes for CloseOnEndClass.
'1=  Simply hide form when exiting. This can prevent the
'    viewer from having to re-launch with each image open.
'
'    Default value = 0
'**********************************************************

'**********************************************************
'Info on lcWait flag
'Wait for viewer to close before returning control to user
'0 = No wait for viewer to close before return to use
'1=Wait for viewer to close before releasing back to user.
'**********************************************************

'**********************************************************
'This combo is a sample of launching an image and viewing
'and returning to user right away. With each subsequent call,
'the same viewer window will be used and a new image will be
'opened in the viewer Window. This scenario is nice if the
'user wants to always have the viewer Window open on their
'desktop and have the image file refresh to a new image
'as needed.
'Note: When this scenario is used, the File/Exit menu is the
'ONLY way to get the viewer Window to close.
'**********************************************************
''''objView.CloseonEndClass = 0
''''lcWait = 0

'**********************************************************
'This combo is a sample of launching an image and viewing
'and staying locked up until user closes viewer Window.
'Note: This is the most common scenario fr viewing.
'**********************************************************
objView.CloseonEndClass = 1
lcWait = 1

'**********************************************************
' Display document
' P1 - String = Image name (C:\TEMP\TEST4.TIF)
' P2 - Keep open  (0=Return to user right away/1=Wait for user to close image)
'**********************************************************

'**********************************************************
'Sample Set Doc File Name
'**********************************************************
'''sDocFile = "c:\tiff204196.tif"

'**********************************************************
'Show Doc File
'**********************************************************
rtn = objView.OpenDisplayImage(sDocFile, lcWait)

'**********************************************************
'Release viewer object
'**********************************************************
Set objView = Nothing

End Sub
Personal tools