home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / prnt2.zip / PrnWnd.C < prev    next >
C/C++ Source or Header  |  1995-03-08  |  5KB  |  147 lines

  1. #pragma    title("Printer Driver  --  Version 2  --  (PrnWnd.C)")
  2. #pragma    subtitle("   Application Window - Interface Definitions")
  3.  
  4. #pragma    info(noext)
  5.  
  6. #define    INCL_WIN           /* Include OS/2 PM Windows Interface    */
  7.  
  8. #include <os2.h>
  9.  
  10. #include "appdefs.h"
  11. #include "prnsetup.h"
  12.  
  13. /* This    module contains    application window procedure.            */
  14.  
  15. /* Filename:   PrnWnd.C                            */
  16.  
  17. /*  Version:   2                            */
  18. /*  Created:   1995-03-07                        */
  19. /*  Revised:   1995-03-08                        */
  20.  
  21. /* Routines:   MRESULT EXPENTRY    PrintDriverWndProc(HWND    hWnd,        */
  22. /*                           ULONG msg,        */
  23. /*                           MPARAM mp1,        */
  24. /*                           MPARAM mp2);        */
  25.  
  26. /************************************************************************/
  27. /************************************************************************/
  28. /************************************************************************/
  29. /* DISCLAIMER OF WARRANTIES:                        */
  30. /* -------------------------                        */
  31. /* The following [enclosed] code is sample code    created    by IBM        */
  32. /* Corporation and Prominare Inc.  This    sample code is not part    of any    */
  33. /* standard IBM    product    and is provided    to you solely for the purpose    */
  34. /* of assisting    you in the development of your applications.  The code    */
  35. /* is provided "AS IS",    without    warranty of any    kind.  Neither IBM nor    */
  36. /* Prominare shall be liable for any damages arising out of your    */
  37. /* use of the sample code, even    if they    have been advised of the    */
  38. /* possibility of such damages.                        */
  39. /************************************************************************/
  40. /************************************************************************/
  41. /************************************************************************/
  42. /*               D I S C L A I M E R                */
  43. /* This    code is    provided on an as is basis with    no implied support.    */
  44. /* It should be    considered freeware that cannot    be rebundled as        */
  45. /* part    of a larger "*ware" offering without our consent.        */
  46. /************************************************************************/
  47. /************************************************************************/
  48. /************************************************************************/
  49.  
  50. /* Copyright ╕ International Business Machines Corp., 1995.        */
  51. /* Copyright ╕ 1995  Prominare Inc.  All Rights    Reserved.        */
  52.  
  53. /* --------------------------------------------------------------------    */
  54.  
  55. #pragma    subtitle("   Client Window - Client Window Procedure")
  56. #pragma    page( )
  57.  
  58. /* --- PrintDriverWndProc ------------------------------ [ Public ] ---    */
  59. /*                                    */
  60. /*     This function is    used to    process    the messages sent to the    */
  61. /*     applications client window.                    */
  62. /*                                    */
  63. /*     Upon Entry:                            */
  64. /*                                    */
  65. /*     HWND   hWnd; = Window Handle                    */
  66. /*     ULONG  msg;  = PM Message                    */
  67. /*     MPARAM mp1;  = Message Parameter    1                */
  68. /*     MPARAM mp2;  = Message Parameter    2                */
  69. /*                                    */
  70. /*     Upon Exit:                            */
  71. /*                                    */
  72. /*     PrintDriverWndProc = Message Handling Result            */
  73. /*                                    */
  74. /* --------------------------------------------------------------------    */
  75.  
  76. MRESULT    EXPENTRY PrintDriverWndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  77.  
  78. {
  79. RECTL rcl;                /* Window Rectangle            */
  80. HPS   hPS;                /* Presentation Space Handle    */
  81.  
  82.  
  83. switch ( msg )
  84.    {
  85.             /* Window being    created, perform window        */
  86.             /* initialization                */
  87.    case    WM_CREATE :
  88.  
  89.        hptrWait     = WinQuerySysPointer(HWND_DESKTOP, SPTR_WAIT,    FALSE);
  90.        hptrArrow = WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW,    FALSE);
  91.  
  92.             /************************************************/
  93.             /* PDSGetTemplate is used to allow controls in    */
  94.             /* windows.  Do    not remove this    function if you    */
  95.             /* intend to include controls within the window.*/
  96.             /************************************************/
  97.  
  98.     PDSGetTemplate(hWnd, WIN_PRINTDRIVER);
  99.     break;
  100.             /* Process key press from keyboard        */
  101.    case    WM_CHAR    :
  102.             /************************************************/
  103.             /* PDSKeyProc is used to allow controls    in    */
  104.             /* windows.  Do    not remove this    function if you    */
  105.             /* intend to include controls within the window.*/
  106.             /************************************************/
  107.  
  108.     return(PDSKeyProc(hWnd,    msg, mp1, mp2));
  109.             /* Process control selections            */
  110.             /* Process menu    and button selections        */
  111.    case    WM_COMMAND :
  112.     switch ( SHORT1FROMMP(mp1) )
  113.         {
  114.        case    IDM_PRINT :
  115.            WinDlgBox(HWND_DESKTOP, hwndPrnSetupFrame, (PFNWP)FilePrintDlgProc,
  116.              (HMODULE)NULL,    DLG_FILEPRN, NULL);
  117.            break;
  118.         case IDM_PRINTERSETUP :
  119.         WinDlgBox(HWND_DESKTOP,    hwndPrnSetupFrame, (PFNWP)PrnSetupDlgProc,
  120.               (HMODULE)NULL, DLG_PRNSETUP, (PVOID)&prn);
  121.         break;
  122.         }
  123.     break;
  124.             /* Erase window    background            */
  125.  
  126.    case    WM_ERASEBACKGROUND :
  127.     WinQueryWindowRect(hWnd, &rcl);
  128.     WinFillRect((HPS)LONGFROMMP(mp1), &rcl,    SYSCLR_WINDOW);
  129.     break;
  130.             /* Paint client    window                */
  131.    case    WM_PAINT :
  132.     hPS = WinBeginPaint(hWnd, (HPS)NULL, &rcl);
  133.     WinFillRect(hPS, &rcl, SYSCLR_WINDOW);
  134.     WinEndPaint(hPS);
  135.     break;
  136.             /* Window being    destroyed, perform clean-up    */
  137.             /* operations                    */
  138.    case    WM_DESTROY :
  139.     break;
  140.  
  141.             /* Default message processing            */
  142.    default :
  143.        return(WinDefWindowProc(hWnd, msg, mp1, mp2));
  144.    }
  145. return(0L);
  146. }
  147.