## Presentation Device Driver Reference for OS/2

[prev][next][parent][TOC]

### SplQmOpen - Remarks

This sample code will initialize a PDEVOPENSTRUC and use it to call the function.

    #define INCL_SPL

    #define INCL_SPLDOSPRINT

    #define INCL_BASE

    #define INCL_ERRORS

    #include <os2.h>

    #include <stdio.h>

    #include <stdlib.h>

    VOID main()

    {

      HSPL hspl;

      PDEVOPENSTRUC pdata;        /* Pointer to a DEVOPENSTRUC structure */

      PSZ  pszToken = "*";        /* Spooler info identifier             */

      /* Allocate memory for pdata */

      if ( !DosAllocMem( &pdata,sizeof( DEVOPENSTRUC ),

         (PAG_READ|PAG_WRITE|PAG_COMMIT ) )

      {

        /* Initialize elements of pdata */

        pdata->pszLogAddress      = "LPT1Q1";

        pdata->pszDriverName      = "IBMNULL";

        pdata->pdriv              = NULL;

        pdata->pszDataType        = "PM_Q_STD";

        pdata->pszComment         = NULL;

        pdata->pszQueueProcName   = NULL;

        pdata->pszQueueProcParams = NULL;

        pdata->pszSpoolerParams   = NULL;

        pdata->pszNetworkParams   = NULL;

        hspl = SplQmOpen( pszToken,4L,( PQMOPENDATA )pdata );

        if ( hspl != SPL_ERROR )        /* Good spooler handle */

        {

           printf("SplQmOpen handle is %d\n",hspl);

        }

        else

        {

           printf("SplQmOpen failed.\n");

        }

      }

    }