Intermec 6200 Reference Guide

Page of 410
SECTION 3
Supporting Windows Applications
3-40    PEN*KEY
R
 6200/6300 Hand-Held Computer Programmer’s Reference Guide
Retrieving the API Entry Point PrtService
To use the API, the application must first obtain the entry point for the
PrtService
 procedure as described in the following code fragment:
hInstNorPrnt = LoadLibrary( “NORIRDA.DRV” );
if ( hInstNorPrnt <= HINSTANCE_ERROR ) {
 MessageBox( NULL, “Could not open printer driver.”, “ERROR”,
 MB_OK | MB_ICONEXCLAMATION );
return FALSE;
}
lpfnPrtService = (fpPrtService)GetProcAddress( hInstNorPrnt,
 “PrtService” );
if ( lpfnPrtService == NULL ) 
{
MessageBox( NULL, “Unable to get address for\nPrtService”, 
“ERROR”, MB_OK | MB_ICONEXCLAMATION );
return FALSE;
}
Calling PrtService
NORIRDA.DRV contains an exported procedure:
PrtService( HINSTANCE hInst, WORD wOpt, LPARAM lParam1, LPARAM lParam2)
that provides the API for the driver.  The parameters to the procedure are as
follows:
HINSTANCE hInst Instance handle to our application
WORD wOpt
Option for action you want to perform
LPARAM lParam1 Double word that depends on the 
particular option
LPARAM lParam2 Double word that depends on the 
particular option
The value returned by 
PrtService
 
depends on the option selected.  See specific
options for more details.
The entry point can be called just like any Windows procedure, as shown in the
following fragment:
if (lpfnPrtService(hInst, PRT_ENABLE, (LPARAM)NULL, 
  (LPARAM)NULL ) < 1) 
{
MessageBox( NULL, “Unable to enable printer driver”, “ERROR”,
MB_OK | MB_ICONEXCLAMATION );
return FALSE;
}
3. Windows
Applications