home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 19 Printer / 19-Printer.zip / LAPRINT.ZIP / LAPRINT.H < prev    next >
C/C++ Source or Header  |  1991-01-23  |  11KB  |  298 lines

  1. /* KNB Version 2.00 */
  2.  
  3. /************************************************************************
  4. *                                                                       *
  5. *  (c) Cray Research, Inc., 1991.  All rights reserved.                 *
  6. *                                                                       *
  7. *     This program and/or module and all modifications made by Cray     *
  8. *  Research, Inc., are the sole property of Cray Research, Inc., and    *
  9. *  shall not be made available to or used by any person or persons      *
  10. *  without the prior written permission of Cray Research, Inc.          *
  11. *                                                                       *
  12. *     Programs and/or modules which are deemed in the public domain or  *
  13. *  whose copyright is held by another legal entity other than Cray      *
  14. *  Research, Inc., shall be deemed excluded from the above named        *
  15. *  restrictions and protections.                                        *
  16. *                                                                       *
  17. *     All changes made by Cray Research Inc which represent original    *
  18. *  work, modifications, descriptions or ideas to the above excluded     *
  19. *  programs and/or modules shall not be made available to or used by    *
  20. *  any person or persons without the prior written permission of        *
  21. *  Cray Research, Inc.                                                  *
  22. *                                                                       *
  23. ************************************************************************/
  24.  
  25. #define INCL_PM
  26. #define INCL_DOSPROCESS
  27. #include <os2.h>
  28. #include "LAPRINT.rch"
  29.  
  30. #include <mt\stdio.h>
  31. #include <mt\stdlib.h>
  32. #include <mt\string.h>
  33. #include <mt\ctype.h>
  34. #include <mt\stddef.h>
  35. #include <mt\process.h>
  36. #define WM_FREE_MEM (WM_USER+0)
  37. #define WM_FAILEDVALIDATE (WM_USER+1)
  38. #define WM_USER_DEFINED_CODE (WM_USER+2)
  39. #define ID_LOGO_TIMER                            10
  40.  
  41. /* these structures are used to add the program name to the task list      */
  42. EXTERN HSWITCH hSwitch;
  43. EXTERN SWCNTRL Swctl;
  44.  
  45. EXTERN HELPINIT hiLAPRINTHelp;     /* Help initialization structure        */
  46. EXTERN HWND     hWndLAPRINTHelp;   /* Handle to Help window                */
  47. EXTERN CHAR *FPRINTObjStack;
  48. EXTERN SEL  FPRINTObjSel;
  49. EXTERN CHAR *FSELECTDID_PRINTObjStack;
  50. EXTERN SEL  FSELECTDID_PRINTObjSel;
  51. EXTERN CHAR *FQUERYREMOTEPRINTERObjStack;
  52. EXTERN SEL  FQUERYREMOTEPRINTERObjSel;
  53.  
  54. EXTERN CHAR szAppName[20]; /* class name of application                    */
  55. EXTERN CHAR szFPRINTObjAppName[30]; /* class name of object window         */
  56. EXTERN CHAR szFSELECTDID_PRINTObjAppName[30]; /* class name of object window */
  57. EXTERN CHAR szFQUERYREMOTEPRINTERObjAppName[30]; /* class name of object window */
  58.  
  59.  
  60. EXTERN HAB  hAB;         /* Handle to the Anchor Block                     */
  61. EXTERN HMQ  hMQ;         /* Handle to the Message Queue                    */
  62. EXTERN HWND hWndFrame;   /* Handle to the Window Frame                     */
  63. EXTERN HWND hWndClient;  /* Handle to the Client Window                    */
  64. EXTERN HWND hWndFPRINTObject; /* Handle to an object window                */
  65. EXTERN HWND hWndFSELECTDID_PRINTObject; /* Handle to an object window      */
  66. EXTERN HWND hWndFQUERYREMOTEPRINTERObject; /* Handle to an object window   */
  67. EXTERN HWND hWndQUERYPRT;
  68.  
  69. /************************************************************************
  70. *                                                                       *
  71. *     Programmer added externals and associated defines.                *
  72. *                                                                       *
  73. ************************************************************************/
  74. EXTERN HWND hWndFSELECT;
  75. EXTERN BOOL BgmPrintActive;
  76. EXTERN INT  BgmConfigNeedsSaving;
  77. #define BGM_SAVE_THEN_EXIT 3
  78.  
  79. typedef struct 
  80.          {
  81.           char   szConfig_Directory[101];
  82.           char   szConfig_Filename[101];
  83.          } CFGOPENStruct;
  84.  
  85. #define OFFSET_CFGOPEN 0
  86.  
  87. typedef struct 
  88.          {
  89.           char   szConfig_Directory[101];
  90.           char   szConfig_Filename[101];
  91.          } CFGSAVEStruct;
  92.  
  93. #define OFFSET_CFGSAVE 1*sizeof(char FAR *)
  94.  
  95. typedef struct 
  96.          {
  97.           char   szSelected_Directory[101];
  98.           char   szSelected_Filename[101];
  99.          } FSELECTStruct;
  100.  
  101. #define OFFSET_FSELECT 2*sizeof(char FAR *)
  102.  
  103. typedef struct 
  104.          {
  105.           char   szSelected_Printer_Name[25];
  106.           char   szPrinter_List[128][129];
  107.          } SELPRTERStruct;
  108.  
  109. #define OFFSET_SELPRTER 3*sizeof(char FAR *)
  110.  
  111. typedef struct 
  112.          {
  113.           char   szAdd_Printer_Name[25];
  114.           char   szAdd_Printer_Desc[104];
  115.          } PRTERADDStruct;
  116.  
  117. #define OFFSET_PRTERADD 4*sizeof(char FAR *)
  118.  
  119. typedef struct 
  120.          {
  121.           char   szDelete_Printer_Name[25];
  122.          } PRTERDELStruct;
  123.  
  124. #define OFFSET_PRTERDEL 5*sizeof(char FAR *)
  125.  
  126. typedef struct 
  127.          {
  128.           char   szChange_Printer_Name[25];
  129.           char   szChange_Printer_Desc[104];
  130.          } PRTCHANGStruct;
  131.  
  132. #define OFFSET_PRTCHANG 6*sizeof(char FAR *)
  133.  
  134. typedef struct 
  135.          {
  136.           char   szSelected_Server_Name[25];
  137.           int    ckServer_UNIX_Format[128];
  138.           char   szServer_List[128][129];
  139.           int    ckSelected_UNIX_Format;
  140.          } SELSERVStruct;
  141.  
  142. #define OFFSET_SELSERV 7*sizeof(char FAR *)
  143.  
  144. typedef struct 
  145.          {
  146.           char   szAdd_Server_Name[25];
  147.           char   szAdd_Server_Desc[104];
  148.          } ADDSERVStruct;
  149.  
  150. #define OFFSET_ADDSERV 8*sizeof(char FAR *)
  151.  
  152. typedef struct 
  153.          {
  154.           char   szDelete_Server_Name[25];
  155.          } DELSERVStruct;
  156.  
  157. #define OFFSET_DELSERV 9*sizeof(char FAR *)
  158.  
  159. typedef struct 
  160.          {
  161.           char   szChange_Server_Name[25];
  162.           char   szChange_Server_Desc[104];
  163.          } CHNGSERVStruct;
  164.  
  165. #define OFFSET_CHNGSERV 10*sizeof(char FAR *)
  166.  
  167. typedef struct 
  168.          {
  169.           char   szQuery_Remote_Printer_List[128][91];
  170.          } QUERYPRTStruct;
  171.  
  172. #define OFFSET_QUERYPRT 11*sizeof(char FAR *)
  173.  
  174. /************************************************************************
  175. *                                                                       *
  176. *     Programmer added structures.                                      *
  177. *                                                                       *
  178. ************************************************************************/
  179.  
  180. typedef struct LOADRETURNStruct
  181.          {
  182.            int free_entry;
  183.            int last_entry;
  184.            int number_of_entries;
  185.          } LOADRETURNStruct;
  186.  
  187. /* Function prototypes                                                     */
  188. VOID FAR FPRINTObjFunction(VOID);
  189. VOID FAR FSELECTDID_PRINTObjFunction(VOID);
  190. VOID FAR FQUERYREMOTEPRINTERObjFunction(VOID);
  191. USHORT cwCheckPulldown(HWND, USHORT);
  192. INT cwCenter(HWND, HWND);
  193. INT cwEnableMenuItem(HWND, INT, INT);
  194. INT cwFillFileListBox(HWND, PSZ, INT);
  195. INT cwSetInitDlgStatus(HWND);
  196. INT cwFreeDlgMemory(HWND);
  197. void lmemset(void FAR *, CHAR, INT);
  198. PSZ longstrcpy(PSZ, PSZ);
  199. INT cwRegisterClass(VOID);
  200. HWND cwCreateWindow(HWND, ULONG, PCH, PCH, USHORT, INT, INT, INT, INT, PHWND, ULONG, USHORT);
  201.  
  202. /* pointer for subclassing edit controls                                   */
  203. EXTERN PFNWP pfnEditWndProc;
  204.  
  205. /* define and prototypes for alpha validation of edit controls             */
  206. MRESULT EXPENTRY UDCharWndProc(HWND, USHORT, MPARAM, MPARAM);
  207. INT cwAlphaValidate(char *);
  208. INT cwFillDirListBox(HWND, USHORT, USHORT);
  209.  
  210. MRESULT EXPENTRY WndProc(HWND, USHORT, MPARAM, MPARAM);
  211. MRESULT EXPENTRY FPRINTObjWndProc(HWND, USHORT, MPARAM, MPARAM);
  212. MRESULT EXPENTRY FSELECTDID_PRINTObjWndProc(HWND, USHORT, MPARAM, MPARAM);
  213. MRESULT EXPENTRY FQUERYREMOTEPRINTERObjWndProc(HWND, USHORT, MPARAM, MPARAM);
  214. MRESULT EXPENTRY BGMABOUTMsgProc(HWND, USHORT, MPARAM, MPARAM);
  215. MRESULT EXPENTRY INITIALMsgProc(HWND, USHORT, MPARAM, MPARAM);
  216. MRESULT EXPENTRY CFGOPENMsgProc(HWND, USHORT, MPARAM, MPARAM);
  217. MRESULT EXPENTRY CFGSAVEMsgProc(HWND, USHORT, MPARAM, MPARAM);
  218. MRESULT EXPENTRY FSELECTMsgProc(HWND, USHORT, MPARAM, MPARAM);
  219. MRESULT EXPENTRY SELPRTERMsgProc(HWND, USHORT, MPARAM, MPARAM);
  220. MRESULT EXPENTRY PRTERADDMsgProc(HWND, USHORT, MPARAM, MPARAM);
  221. MRESULT EXPENTRY PRTERDELMsgProc(HWND, USHORT, MPARAM, MPARAM);
  222. MRESULT EXPENTRY PRTCHANGMsgProc(HWND, USHORT, MPARAM, MPARAM);
  223. MRESULT EXPENTRY SELSERVMsgProc(HWND, USHORT, MPARAM, MPARAM);
  224. MRESULT EXPENTRY ADDSERVMsgProc(HWND, USHORT, MPARAM, MPARAM);
  225. MRESULT EXPENTRY DELSERVMsgProc(HWND, USHORT, MPARAM, MPARAM);
  226. MRESULT EXPENTRY CHNGSERVMsgProc(HWND, USHORT, MPARAM, MPARAM);
  227. MRESULT EXPENTRY QUERYPRTMsgProc(HWND, USHORT, MPARAM, MPARAM);
  228.  
  229. /************************************************************************
  230. *                                                                       *
  231. *     Define and prototypes for programmer added functions and          *
  232. *     subroutines.                                                      *
  233. *                                                                       *
  234. ************************************************************************/
  235.  
  236. INT              BgmNew(HWND,
  237.                         BOOL,
  238.                         BOOL,
  239.                         BOOL,
  240.                         BOOL,
  241.                         BOOL,
  242.                         BOOL,
  243.                         BOOL,
  244.                         BOOL,
  245.                         BOOL,
  246.                         BOOL,
  247.                         BOOL,
  248.                         BOOL);
  249.  
  250. INT              BgmReadConfigFile(HWND);
  251.  
  252. INT              BgmWriteConfigFile(HWND,
  253.                                     BOOL);
  254.  
  255. CHAR *           BgmReadConfigLine(HWND,
  256.                                    CHAR *,
  257.                                    INT,
  258.                                    FILE *);
  259.  
  260. MRESULT EXPENTRY BgmLoadListBox(HWND,
  261.                                 USHORT,
  262.                                 CHAR[][129],
  263.                                 CHAR *,
  264.                                 BOOL);
  265.  
  266. INT              BgmDeletePrtSrv(HWND,
  267.                                  USHORT,
  268.                                  USHORT,
  269.                                  CHAR[][129],
  270.                                  CHAR *,
  271.                                  CHAR *);
  272.  
  273. INT              BgmAddPrtSrv(HWND,
  274.                               USHORT,
  275.                               USHORT,
  276.                               CHAR[][129],
  277.                               CHAR *,
  278.                               CHAR *,
  279.                               CHAR *);
  280.  
  281. INT              BgmChangePrtSrv(HWND,
  282.                                  USHORT,
  283.                                  USHORT,
  284.                                  CHAR[][129],
  285.                                  CHAR *,
  286.                                  CHAR *,
  287.                                  CHAR *);
  288.  
  289. INT              BgmPrint(HWND,
  290.                           BOOL);
  291.  
  292. BOOL BgmWriteConfigLine(HWND,
  293.                         BOOL,
  294.                         char *,
  295.                         char *,
  296.                         FILE *);
  297.  
  298.