Each of the run commands can be used to identify events for the driver to signal. This is useful for signaling to your application that a critical point in the printing process has been reached (for example, a page has been written, an output file has been released by the driver, or the print job has completed). See the Run tab for more information about the individual run events.

The driver only opens and signals the events. It is your responsibility to create and block on the events in your own code.

Use the following field on the Run tab to configure a run command to signal an event.

Field

Argument

Command:

{EventName}

Use curly braces around the event name to designate to the driver that this is an event name. You do not need to specify the curly braces when creating and using the event name in your code.

 

Example: Using End of Job to Signal an Event

The following sample shows how you can configure the End of Job run command to signal an event that you could then wait for in your code.

Run Command Settings for End of Job:

Sample C++ Code:

Below is a C++ code snippet showing the creation of the event and how to wait for the driver to signal the event before continuing the processing of the file.

DWORD dwWait = WAIT_TIMEOUT; 

 

// Create the event

m_hEvent = ::CreateEvent( NULL, FALSE, FALSE, _T("Global\\JobComplete") );

if ( m_hEvent == NULL ) {

   ::AfxMessageBox( _T("Failed to create the event") );

   return ;

}   

 

// do some other coding here, such as printing the document

 

// wait for event, 2 min 

dwWait = ::WaitForSingleObject( this->m_hEvent, 120000 );

 

if ( WAIT_OBJECT_0 == dwWait ) {

   ::AfxMessageBox( _T("Success on event signal") );

 

   // do something with the complete file here such as 

   // uploading to an FTP site or an in-house archive system

 

}

else if ( WAIT_TIMEOUT == dwWait ){

   ::AfxMessageBox( _T("TIMEOUT on event signal") );

}

else {

   ::AfxMessageBox( _T("FAIL on event signal") );

}