Call the following sample subroutine from VB, VB.Net, or VBScripting to view a document with RJS 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. You cannot hide the form when not waiting
'    for the viewer to exit; otherwise the program is left invisible
'    in memory, and you have to kill the process in the task manager.
'1=  Close program when user exits.
'
'    Default value = 1
'**********************************************************

'**********************************************************
'Hide Form on Exiting Flag
'0 = Do not hide form. See notes for CloseOnEndClass.
'1=  Hide form when exiting. Use to prevent RJS Imaging
'    Viewer from having to re-launch for each image.
'
'    Default value = 0
'**********************************************************

'**********************************************************
'Info on lcWait flag
'Wait for RJS Imaging Viewer to close before returning control to user
'0 = Do not wait for RJS Imaging Viewer to close before returning to user.
'1 = Wait for RJS Imaging Viewer to close before releasing back to user.
'**********************************************************

'**********************************************************
'The following sample launches an image for viewing
'and returns to the user right away. With each subsequent call,
'the same viewer window is used, and a new image is opened
'in the RJS Imaging Viewer window. Use to leave the window open
'on a user desktop and display a new image as needed.
'Note: When using this scenario, File/Exit is the
'ONLY way to close the RJS Imaging Viewer window.
'**********************************************************
''''objView.CloseonEndClass = 0
''''lcWait = 0

'**********************************************************
'The following sample launches an image for viewing
'and stays locked up until user closes the RJS Imaging Viewer window.
'Note: This is the most common scenario for 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

 


Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: December 10, 2016