Attribute VB_Name = "WndProc"
Option Explicit

Public g_lWndProcOrg As Long

Public Function WindowProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

    Select Case Msg

        Case WM_PAVO_PRINTER

            Select Case wParam
                Case MSG_JOB_BEGIN
                        MsgBox "Job is begining by driver!!", 0, "MSG_JOB_BEGIN"

                Case MSG_JOB_END
                        MsgBox "Job is processed by driver!!", 0, "MSG_JOB_END"

                Case MSG_JOB_CANCELED
                        MsgBox "Job is canceled by driver!!", 0, "MSG_JOB_CANCELED"

                Case MSG_DEVICE_STATUS
                        If lParam <> PAVO_DS_PRINTING And lParam <> PAVO_DS_PROCESSING_DATA And lParam <> PAVO_DS_SENDING_DATA Then
                            MsgBox "Error happened!! " & lParam, 0, "DemoVB"
                        End If

                Case MSG_JOB_PRINTED
                        MsgBox "Job is printed completely by printer!!", 0, "MSG_JOB_PRINTED"

            End Select

        Case Else
            WindowProc = CallWindowProc(g_lWndProcOrg, hWnd, Msg, wParam, lParam)
    End Select

End Function

