Compile subroutine OIPI_Errors(ErrorCode, Application)

$insert SRP_APP_INSERTS
$insert MSG_EQUATES

Text = ""
Text<1> = "The INIT message failed because OIPI could not start a new printing session.  This error can occur if another printing session has not terminated or if GPF errors occur."
Text<2> = "The bitmap can not be found.  The path and filename are not valid for the BMP Set_Printer message."
Text<3> = "The user clicked the Cancel button from the Printer Setup dialog box displayed with the INIT message."
Text<4> = "Invalid MSG parameter passed to the Set_Printer function."
Text<5> = "The INIT message failed because the OIPI.EXE or support files could not be found."
Text<5> = Text<5>:"  The OIPI.EXE and support files should be located in the OpenInsight directory.  See the OpenInsight Modifications for more details on the support files that are required by OIPI."
Text<6> = "The ColLen parameter of the HEADER message contains invalid information.  The ColLen parameter must contain numerical information."
Text<7> = "The user has clicked the Cancel button from the Printing dialog box."
Text<8> = "No ColLen information was provided for the TABLE message."
Text<9> = "Invalid MSG parameter passed to the Get_Printer function."
Text<10> = "Internal error with SendMessage and the OIPI.EXE."
Text<11> = "Invalid ColLen information was provided in the HEADER message for the TEXTCOL message."
Text<12> = "The Width or Height that was specified in the INIT message was too large.  The Width and Height must be smaller than the page size specified in the Printer Setup dialog.  The print job will continue with the default page size."
Text<13> = "There are no printers defined or no default printer is selected."
Text<14> = "Invalid PageSize, PageWidth, or PageHeight for the default printer was specified with the Set_Printer function."
Text<15> = "Invalid PaperBin was specified with the Set_Printer function."
Text<16> = "Invalid Duplex mode was specified with the Set_Printer function."
Text<17> = "The current printer does not support multiple copies."

ErrorCode = Neg(ErrorCode)
ErrorText = Text<ErrorCode>

If Len(ErrorText) else ErrorText = "An unexpected error has occured (#":ErrorCode:"). Please report this immediately to SRP Computer Solutions, Inc."

Msg_struct = ""
Msg_struct<MTEXT$> = ErrorText
Msg_struct<MTYPE$> = "BO"
Msg_struct<MMODAL$> = "A"
Msg_struct<MICON$> = "*"
Msg_struct<MBKCOLOR$> = Msg_Light_Grey$
Msg_struct<MCAPTION$> = "OIPI Error"
Msg(@Window, Msg_struct)

Return
