home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dbcs.zip / PRINT.C < prev    next >
C/C++ Source or Header  |  1996-01-20  |  6KB  |  160 lines

  1. #pragma    title("DBCS Driver  --  Version 1  --  (Print.C)")
  2. #pragma    subtitle("   main Entry Poiint - Interface Definitions")
  3.  
  4. #pragma    info(noext, nopar)
  5.  
  6. #define    INCL_DOS           /* Include OS/2 DOS Kernal        */
  7. #define    INCL_NLS           /* Include OS/2 NLS Support        */
  8. #define    INCL_GPI           /* Include OS/2 PM GPI Interface    */
  9. #define    INCL_WIN           /* Include OS/2 PM Windows Interface    */
  10.  
  11. #include <os2.h>
  12.  
  13. #include "appdefs.h"
  14. #include "prnsetup.h"
  15.  
  16. /* This    module contains    main function for the Print Driver application.    */
  17.  
  18. /* The executable is created using the following options:        */
  19. /*                                    */
  20. /* Option           Value                        */
  21. /* ------           -----                        */
  22. /* Op Sys           OS/2 PM Executable                */
  23. /* Optimization           Maximize                        */
  24. /* Compile Type           Subsystem                    */
  25. /* CPU               80486                        */
  26. /* Warning Level       3                        */
  27. /*                                    */
  28. /* Equivalent command line invocation:                    */
  29. /*                                    */
  30. /*  Icc    -C -G4 -O+ -Rn -W3 Print.C          IBM C    Set++        */
  31. /*  BCC    -Ox -v-    -w -c Print.C              Borland C++ for OS/2    */
  32. /*  Wcl386 -c -ms -4s -s -ox -zp4 -w3 Print.C      WATCOM C/C++        */
  33.  
  34. /* Filename:   Print.C                            */
  35.  
  36. /*  Version:   1                            */
  37. /*  Created:   1996-01-19                        */
  38. /*  Revised:   1996-01-19                        */
  39.  
  40. /* Routines:   int main( );                        */
  41.  
  42. /************************************************************************/
  43. /************************************************************************/
  44. /************************************************************************/
  45. /* DISCLAIMER OF WARRANTIES:                        */
  46. /* -------------------------                        */
  47. /* The following [enclosed] code is sample code    created    by IBM        */
  48. /* Corporation and Prominare Inc.  This    sample code is not part    of any    */
  49. /* standard IBM    product    and is provided    to you solely for the purpose    */
  50. /* of assisting    you in the development of your applications.  The code    */
  51. /* is provided "AS IS",    without    warranty of any    kind.  Neither IBM nor    */
  52. /* Prominare shall be liable for any damages arising out of your    */
  53. /* use of the sample code, even    if they    have been advised of the    */
  54. /* possibility of such damages.                        */
  55. /************************************************************************/
  56. /************************************************************************/
  57. /************************************************************************/
  58. /*               D I S C L A I M E R                */
  59. /* This    code is    provided on an as is basis with    no implied support.    */
  60. /* It should be    considered freeware that cannot    be rebundled as        */
  61. /* part    of a larger "*ware" offering without our consent.        */
  62. /************************************************************************/
  63. /************************************************************************/
  64. /************************************************************************/
  65.  
  66. /* Copyright ╕ International Business Machines Corp., 1996.        */
  67. /* Copyright ╕ 1996  Prominare Inc.  All Rights    Reserved.        */
  68.  
  69. /* --------------------------------------------------------------------    */
  70.  
  71. PSZ pszPrnSetupClassName = (PSZ)"PrnSetup";
  72. PSZ pszToolBarClassName     = (PSZ)"ToolBar";
  73.  
  74.  
  75. INT main(INT argc, CHAR    *argv[ ])
  76.  
  77. {
  78. QMSG  qmsg;               /* PM Message Queue Holder        */
  79.  
  80. #if defined(INCL_VALAPI)
  81.  
  82. ValInitialize("Print Example", NULL, VL_VIEWPORT);
  83.  
  84. #endif
  85.  
  86.                /* Initialize the program for PM    and create the    */
  87.                /* message queue                    */
  88.  
  89. hmqPrnSetup = WinCreateMsgQueue(hAB = WinInitialize(0UL), 0L);
  90.  
  91.                /* Register the window class            */
  92.  
  93. if ( !WinRegisterClass(hAB, pszPrnSetupClassName, (PFNWP)PrintDriverWndProc, CS_SYNCPAINT | CS_SIZEREDRAW | CS_CLIPCHILDREN, 0UL) )
  94.    return(0);
  95.                /* Register the window class            */
  96.  
  97. if ( !WinRegisterClass(hAB, pszToolBarClassName, (PFNWP)ToolBarWndProc,    CS_SYNCPAINT | CS_SIZEREDRAW, 0UL) )
  98.    return(0);
  99.                /* Get default printer to use            */
  100.  
  101. if ( PrnCreatePrinterList(&prn)    )
  102.    prn.hAB = hAB;
  103.                /* Determine if DBCS active and perform any    */
  104.                /* necessary initialization            */
  105. fQueryDBCS( );
  106.                /* Create the main program window        */
  107.  
  108. if ( !(hwndPrnSetupFrame = CreateStdWindow(HWND_DESKTOP, WS_VISIBLE,
  109.                        FCF_NOBYTEALIGN | FCF_TASKLIST |
  110.                        FCF_TITLEBAR    | FCF_ICON |
  111.                        FCF_SYSMENU | FCF_MENU | FCF_MINMAX |
  112.                        FCF_DBE_APPSTAT | FCF_SIZEBORDER,
  113.                        pszPrnSetupClassName, (PSZ)"Print Driver", 0L,
  114.                        (HMODULE)NULL, WIN_PRINTDRIVER, &hwndPrnSetup, 6, 5,    203, 120)) )
  115.    return(0);
  116.  
  117.  
  118.  
  119. InitApp(hwndPrnSetupFrame, hwndPrnSetup, "Print Font Example");
  120.  
  121.                /* Create Help instance and associate it    with    */
  122.                /* the programs frame window            */
  123.  
  124. if ( (hwndHelp = WinCreateHelpInstance(hAB, &helpinit))    != (HWND)NULL )
  125.    WinAssociateHelpInstance(hwndHelp, hwndPrnSetupFrame);
  126.  
  127.                /* Get and dispatch the message to program    */
  128.                /* windows                    */
  129.  
  130. while (    WinGetMsg(hAB, &qmsg, (HWND)NULL, 0UL, 0UL) )
  131.    WinDispatchMsg(hAB, &qmsg);
  132.  
  133.                /* Destroy the printer list            */
  134. if ( prn.hAB !=    0UL )
  135.    PrnDestroyPrinterList(&prn);
  136.  
  137.                /* Destroy the Help instance associated with the    */
  138.                /* the programs frame window            */
  139.  
  140. if ( hwndHelp )
  141.    {
  142.    WinAssociateHelpInstance((HWND)NULL,    hwndPrnSetupFrame);
  143.    WinDestroyHelpInstance(hwndHelp);
  144.    }
  145.  
  146.                /* Have received    a WM_QUIT, start the program    */
  147.                /* shutdown by destroying the program windows    */
  148.                /* and destroying the message queue        */
  149.  
  150. WinDestroyWindow(hwndPrnSetupFrame);
  151.  
  152. WinDestroyMsgQueue(hmqPrnSetup);
  153.  
  154.                /* Notify PM that main program thread not needed    */
  155.                /* any longer                    */
  156. WinTerminate(hAB);
  157.                /* Exit back to OS/2 cleanly            */
  158. return(0);
  159. }
  160.