| 1 | #include <callcups.h> | 
|---|
| 2 | #include <process.h> | 
|---|
| 3 | #include <ecdebug.h> | 
|---|
| 4 |  | 
|---|
| 5 | void CupsThread(void *arg); | 
|---|
| 6 | extern ECUPSSESSIONDATA eCUPSSession; | 
|---|
| 7 |  | 
|---|
| 8 |  | 
|---|
| 9 | ULONG CallCups(PECUPSSESSIONDATA peCUPSSession) | 
|---|
| 10 | { | 
|---|
| 11 |  | 
|---|
| 12 | char pszUser[100]; | 
|---|
| 13 | TID            tid; | 
|---|
| 14 | PSZ      ModuleName ="LIBCUPS.DLL"; | 
|---|
| 15 | ULONG ulID; | 
|---|
| 16 | UCHAR    LoadError[256] = "";          /* Area for Load failure information */ | 
|---|
| 17 | HMODULE  ModuleHandle   = NULLHANDLE;  /* Module handle                     */ | 
|---|
| 18 | PFN      ModuleAddr     = 0;           /* Pointer to a system function      */ | 
|---|
| 19 | ULONG    ModuleType     = 0;           /* Module type                       */ | 
|---|
| 20 | APIRET   rc             = NULL;    /* Return code                       */ | 
|---|
| 21 |  | 
|---|
| 22 |  | 
|---|
| 23 | rc = DosLoadModule(LoadError,               /* Failure information buffer */ | 
|---|
| 24 | sizeof(LoadError),       /* Size of buffer             */ | 
|---|
| 25 | ModuleName,              /* Module to load             */ | 
|---|
| 26 | &ModuleHandle);          /* Module handle returned     */ | 
|---|
| 27 | if (rc != NULL) | 
|---|
| 28 | return; | 
|---|
| 29 |  | 
|---|
| 30 | if(DosQueryProcAddr(ModuleHandle,NULL,"_cupsPrintFile",&pfncupsPrintFile)!=NULL) return; | 
|---|
| 31 | if(DosQueryProcAddr(ModuleHandle,NULL,"_cupsSetServer",&pfncupsSetServer)!=NULL) return; | 
|---|
| 32 | if(DosQueryProcAddr(ModuleHandle,NULL,"_cupsUser",&pfncupsUser)!=NULL) return; | 
|---|
| 33 |  | 
|---|
| 34 |  | 
|---|
| 35 | rc = DosCreateThread(&tid,&CupsThread,0l,NULL,0x200000); | 
|---|
| 36 | _PmpfF(("Loaded thread: %d",rc)); | 
|---|
| 37 | //tid = beginThread(CupsThread,NULL,NULL,NULL); | 
|---|
| 38 | DosWaitThread(&tid, DCWW_WAIT); | 
|---|
| 39 |  | 
|---|
| 40 | } | 
|---|
| 41 |  | 
|---|
| 42 |  | 
|---|
| 43 | void CupsThread(void *arg) | 
|---|
| 44 | { | 
|---|
| 45 | _PmpfF(("done loading cups, user: %s",pfncupsUser())); | 
|---|
| 46 | pfncupsSetServer(eCUPSSession.pszPDFMarkLocation); | 
|---|
| 47 | _PmpfF(("cupsPrintfile(%s,%s,%s,0,NULL)",eCUPSSession.pszGSParameters,eCUPSSession.pszPSOutputFile, eCUPSSession.pJobInfo->pszDocument)); | 
|---|
| 48 | pfncupsPrintFile(eCUPSSession.pszGSParameters,eCUPSSession.pszPSOutputFile, eCUPSSession.pJobInfo->pszDocument,0,NULL); | 
|---|
| 49 | } | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|