if (!pInfo || !pszApplicationName) return hdc;
HDC PrnOpenDC( PRTQUEUE *pInfo, PSZ pszApplicationName, int copies, int toPrinter, char *file ){   HDC hdc = 0;   PSZ pszLogAddress;   PSZ pszDataType;   LONG dcType;   DEVOPENSTRUC dop;   char pszQueueProcParams[CCHMAXPATH] = "COP=";   char numCopies[12];   itoa (copies, numCopies, 10);   strcat (pszQueueProcParams, numCopies);   if ( toPrinter ) {      pszLogAddress = pInfo->PQI3 ().pszName;      pszDataType = "PM_Q_STD";      dcType = OD_QUEUED;   } else {      if (file && strlen(file) != 0)          pszLogAddress = (PSZ) file;      else             pszLogAddress = "FILE";      pszDataType = "PM_Q_RAW";      dcType = OD_DIRECT;   }     dop.pszLogAddress      = pszLogAddress;     dop.pszDriverName      = (char*)pInfo->DriverName ();    dop.pdriv              = pInfo->PQI3 ().pDriverData;    dop.pszDataType        = pszDataType;     dop.pszComment         = pszApplicationName;    dop.pszQueueProcName   = pInfo->PQI3 ().pszPrProc;         dop.pszQueueProcParams = pszQueueProcParams;       dop.pszSpoolerParams   = 0;         dop.pszNetworkParams   = 0;         hdc = ::DevOpenDC( 0, dcType, "*", 9, (PDEVOPENDATA) &dop, NULLHANDLE);if (hdc == 0){  ULONG ErrorCode = ERRORIDERROR (::WinGetLastError (0));#ifdef DEBUG  printf ("!ERROR! - Can't open DC for printer %04X\a\n", ErrorCode);#endif}      return hdc;}