home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pres.zip / PRESPRMS.C
Text File  |  1993-09-23  |  22KB  |  458 lines

  1. //  PresPrms.c
  2. //
  3. //    John Clark  09/93
  4. //
  5. //
  6. //    procedures to handle presentation parameters
  7. //
  8. //    include:    INCL_WINSYS
  9. //
  10. //    definitions:
  11. //
  12. //       presentation parameters:
  13. //
  14. //       #define PP_FOREGROUNDCOLOR                      0x00000001L
  15. //       #define PP_FOREGROUNDCOLORINDEX                 0x00000002L
  16. //       #define PP_BACKGROUNDCOLOR                      0x00000003L
  17. //       #define PP_BACKGROUNDCOLORINDEX                 0x00000004L
  18. //       #define PP_HILITEFOREGROUNDCOLOR                0x00000005L
  19. //       #define PP_HILITEFOREGROUNDCOLORINDEX           0x00000006L
  20. //       #define PP_HILITEBACKGROUNDCOLOR                0x00000007L
  21. //       #define PP_HILITEBACKGROUNDCOLORINDEX           0x00000008L
  22. //       #define PP_DISABLEDFOREGROUNDCOLOR              0x00000009L
  23. //       #define PP_DISABLEDFOREGROUNDCOLORINDEX         0x0000000aL
  24. //       #define PP_DISABLEDBACKGROUNDCOLOR              0x0000000bL
  25. //       #define PP_DISABLEDBACKGROUNDCOLORINDEX         0x0000000cL
  26. //       #define PP_BORDERCOLOR                          0x0000000dL
  27. //       #define PP_BORDERCOLORINDEX                     0x0000000eL
  28. //       #define PP_FONTNAMESIZE                         0x0000000fL
  29. //       #define PP_FONTHANDLE                           0x00000010L
  30. //       #define PP_RESERVED                             0x00000011L
  31. //       #define PP_ACTIVECOLOR                          0x00000012L
  32. //       #define PP_ACTIVECOLORINDEX                     0x00000013L
  33. //       #define PP_INACTIVECOLOR                        0x00000014L
  34. //       #define PP_INACTIVECOLORINDEX                   0x00000015L
  35. //       #define PP_ACTIVETEXTFGNDCOLOR                  0x00000016L
  36. //       #define PP_ACTIVETEXTFGNDCOLORINDEX             0x00000017L
  37. //       #define PP_ACTIVETEXTBGNDCOLOR                  0x00000018L
  38. //       #define PP_ACTIVETEXTBGNDCOLORINDEX             0x00000019L
  39. //       #define PP_INACTIVETEXTFGNDCOLOR                0x0000001aL
  40. //       #define PP_INACTIVETEXTFGNDCOLORINDEX           0x0000001bL
  41. //       #define PP_INACTIVETEXTBGNDCOLOR                0x0000001cL
  42. //       #define PP_INACTIVETEXTBGNDCOLORINDEX           0x0000001dL
  43. //       #define PP_SHADOW                               0x0000001eL
  44. //       #define PP_MENUFOREGROUNDCOLOR                  0x0000001fL
  45. //       #define PP_MENUFOREGROUNDCOLORINDEX             0x00000020L
  46. //       #define PP_MENUBACKGROUNDCOLOR                  0x00000021L
  47. //       #define PP_MENUBACKGROUNDCOLORINDEX             0x00000022L
  48. //       #define PP_MENUHILITEFGNDCOLOR                  0x00000023L
  49. //       #define PP_MENUHILITEFGNDCOLORINDEX             0x00000024L
  50. //       #define PP_MENUHILITEBGNDCOLOR                  0x00000025L
  51. //       #define PP_MENUHILITEBGNDCOLORINDEX             0x00000026L
  52. //       #define PP_MENUDISABLEDFGNDCOLOR                0x00000027L
  53. //       #define PP_MENUDISABLEDFGNDCOLORINDEX           0x00000028L
  54. //       #define PP_MENUDISABLEDBGNDCOLOR                0x00000029L
  55. //       #define PP_MENUDISABLEDBGNDCOLORINDEX           0x0000002aL
  56. // 
  57. //       #define PP_USER                                 0x00008000L
  58. //
  59. //       
  60. //       WinQueryPresParam option flags:
  61. //
  62. //       #define QPF_NOINHERIT               0x0001   // Don't inherit
  63. //       #define QPF_ID1COLORINDEX           0x0002   // Convert id1 color index into RGB
  64. //       #define QPF_ID2COLORINDEX           0x0004   // Convert id2 color index into RGB
  65. //       #define QPF_PURERGBCOLOR            0x0008   // Return pure RGB colors
  66. //       #define QPF_VALIDFLAGS              0x000F   // Valid WinQueryPresParams() flags.
  67. //
  68. //
  69. // 
  70. //    structures:
  71. // 
  72. //    typedef struct _PARAM         // param
  73. //    {
  74. //       ULONG   id;                // 4 bytes
  75. //       ULONG   cb;                // 4 bytes
  76. //       BYTE    ab[1];             // 4 bytes
  77. //    } PARAM;
  78. //    typedef PARAM *NPPARAM;
  79. //    typedef PARAM *PPARAM;
  80. //
  81. //
  82. //    typedef struct _PRESPARAMS    // pres
  83. //    {
  84. //       ULONG   cb;                // 4 bytes
  85. //       PARAM   aparam[1];         // 4 bytes
  86. //    } PRESPARAMS;
  87. //    typedef PRESPARAMS *NPPRESPARAMS;
  88. //    typedef PRESPARAMS *PPRESPARAMS;
  89. //
  90. //
  91.  
  92.  
  93. #define INCL_WINSYS
  94.  
  95. #include <os2.h>
  96.  
  97. // internal constants
  98. #define DEF_FGCOLOR              0x00000000L       // black
  99. #define DEF_BKCOLOR              0x00ccccccL       // grey
  100. #define WM_USER_GETWNDPARAMS     0x00001000L       // WM_USER
  101.  
  102. // internal prototypes
  103. MRESULT EXPENTRY YourWndProc(HWND hwnd, ULONG ulMsg, MPARAM mp1, MPARAM mp2);
  104. LONG lStoreWndPresParams(HWND hwnd, ULONG ulBufLen, PVOID pvBuf);
  105.  
  106.  
  107.  
  108. // window proc handler, splice in the WM_PRESPARAMCHANGED case
  109. // define any PP_ value you choose to keep track of
  110.  
  111. MRESULT EXPENTRY YourWndProc(HWND hwnd, ULONG ulMsg, MPARAM mp1, MPARAM mp2)
  112. {
  113.    ULONG ulPPFound;
  114.    static LONG lFgColor = DEF_FGCOLOR;
  115.    static LONG lBkColor = DEF_BKCOLOR;
  116.  
  117.  
  118.    switch(ulMsg)
  119.    {
  120.       case WM_PRESPARAMCHANGED:     // a presentation parameter has changed
  121.          switch(LONGFROMMP(mp1))
  122.          {
  123.             case PP_FOREGROUNDCOLOR:
  124.             case PP_FOREGROUNDCOLORINDEX:
  125.                if(WinQueryPresParam(hwnd, PP_FOREGROUNDCOLOR, PP_FOREGROUNDCOLORINDEX, &ulPPFound, sizeof(LONG), (PVOID)&lFgColor, QPF_NOINHERIT | QPF_ID2COLORINDEX))
  126.                {
  127.                   if(lFgColor == DEF_FGCOLOR)
  128.                      WinRemovePresParam(hwnd, ulPPFound);            // remove if default
  129.  
  130.                   WinInvalidateRect(hwnd, (PRECTL)NULL, FALSE);      // redraw window
  131.                }
  132.                break;
  133.  
  134.             case PP_BACKGROUNDCOLOR:
  135.             case PP_BACKGROUNDCOLORINDEX:
  136.                if(WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, PP_BACKGROUNDCOLORINDEX, &ulPPFound, sizeof(LONG), (PVOID)&lBkColor, QPF_NOINHERIT | QPF_ID2COLORINDEX))
  137.                {
  138.                   if(lBkColor == DEF_BKCOLOR)                        
  139.                      WinRemovePresParam(hwnd, ulPPFound);            // remove if default
  140.  
  141.                   WinInvalidateRect(hwnd, (PRECTL)NULL, FALSE);      // redraw window
  142.                }
  143.                break;
  144.  
  145.             default:                // non applicable parameter
  146.                break;
  147.          }
  148.          break;
  149.  
  150.       case WM_USER_GETWNDPARAMS:    // mp1 = buffer length, mp2 = buffer address
  151.          return MRFROMLONG(lStoreWndPresParams(hwnd, (ULONG)LONGFROMMP(mp1), PVOIDFROMMP(mp2)));
  152.          break;
  153.  
  154.       default:
  155.          return(WinDefWindowProc(hwnd, ulMsg, mp1, mp2));
  156.          break;
  157.    }
  158.  
  159.    return (MRESULT)NULL;  // all window procedures return 0 as a default
  160. }
  161.  
  162.  
  163.  
  164. //
  165. // max ulBufLen = 288L (for all possible params)
  166. // this routine will fill pvBuf with all defined window pres params
  167. // the array returned is suitable to be passed as pPresParams
  168. // ie. WinCreateWindow(,,,,,,,,,,,, PVOID pPresParams)
  169. //
  170. LONG lStoreWndPresParams(HWND hwnd, ULONG ulBufLen, PVOID pvBuf)
  171. {
  172.    LONG         lTmp;
  173.    PPARAM       pparam;
  174.    PPRESPARAMS  ppresparams;
  175.  
  176.  
  177.    // the least possible query is 16 bytes
  178.    if(ulBufLen < 16L || pvBuf == (PVOID)NULL)
  179.       return -1L;    // error, not enough memory
  180.  
  181.    // test window validity
  182.    if(!WinIsWindow(hab, hwnd))
  183.       return -1L;    // error, invalid window handle
  184.  
  185.    // setup memory access
  186.    ppresparams = (PPRESPARAMS)pvBuf;         // cast structure onto memory
  187.    ppresparams->cb = 0L;                     // no entries yet
  188.  
  189.    pparam = ppresparams->aparam;             // cast structure onto memory
  190.  
  191.    ulBufLen -= 4L;                           // used 4 bytes in PRESPARAMS struct
  192.  
  193.  
  194.    /////////////////////////////////////////////////////
  195.    //
  196.    // query every possible presentation parameter...
  197.    //
  198.    /////////////////////////////////////////////////////
  199.  
  200.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  201.    // foreground color -- takes 12 bytes
  202.    if((ulBufLen - ppresparams->cb) < 12L)
  203.       return -1L;    // error, not enough memory
  204.    pparam->cb = WinQueryPresParam(hwnd, PP_FOREGROUNDCOLOR, PP_FOREGROUNDCOLORINDEX,
  205.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  206.    if(pparam->cb)    // was the param found?
  207.    {
  208.       ppresparams->cb += 12L;                      // used 12 bytes
  209.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  210.    }
  211.  
  212.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  213.    // background color -- takes 12 bytes
  214.    if((ulBufLen - ppresparams->cb) < 12L)
  215.       return -1L;    // error, not enough memory
  216.    pparam->cb = WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, PP_BACKGROUNDCOLORINDEX,
  217.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  218.    if(pparam->cb)    // was the param found?
  219.    {
  220.       ppresparams->cb += 12L;                      // used 12 bytes
  221.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  222.    }
  223.  
  224.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  225.    // hilited foreground color -- takes 12 bytes
  226.    if((ulBufLen - ppresparams->cb) < 12L)
  227.       return -1L;    // error, not enough memory
  228.    pparam->cb = WinQueryPresParam(hwnd, PP_HILITEFOREGROUNDCOLOR, PP_HILITEFOREGROUNDCOLORINDEX,
  229.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  230.    if(pparam->cb)    // was the param found?
  231.    {
  232.       ppresparams->cb += 12L;                      // used 12 bytes
  233.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  234.    }
  235.  
  236.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  237.    // hilited background color -- takes 12 bytes
  238.    if((ulBufLen - ppresparams->cb) < 12L)
  239.       return -1L;    // error, not enough memory
  240.    pparam->cb = WinQueryPresParam(hwnd, PP_HILITEBACKGROUNDCOLOR, PP_HILITEBACKGROUNDCOLORINDEX,
  241.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  242.    if(pparam->cb)    // was the param found?
  243.    {
  244.       ppresparams->cb += 12L;                      // used 12 bytes
  245.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  246.    }
  247.  
  248.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  249.    // disabled foreground color -- takes 12 bytes
  250.    if((ulBufLen - ppresparams->cb) < 12L)
  251.       return -1L;    // error, not enough memory
  252.    pparam->cb = WinQueryPresParam(hwnd, PP_DISABLEDFOREGROUNDCOLOR, PP_DISABLEDFOREGROUNDCOLORINDEX,
  253.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  254.    if(pparam->cb)    // was the param found?
  255.    {
  256.       ppresparams->cb += 12L;                      // used 12 bytes
  257.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  258.    }
  259.  
  260.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  261.    // disabled background color -- takes 12 bytes
  262.    if((ulBufLen - ppresparams->cb) < 12L)
  263.       return -1L;    // error, not enough memory
  264.    pparam->cb = WinQueryPresParam(hwnd, PP_DISABLEDBACKGROUNDCOLOR, PP_DISABLEDBACKGROUNDCOLORINDEX,
  265.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  266.    if(pparam->cb)    // was the param found?
  267.    {
  268.       ppresparams->cb += 12L;                      // used 12 bytes
  269.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  270.    }
  271.  
  272.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  273.    // border color -- takes 12 bytes
  274.    if((ulBufLen - ppresparams->cb) < 12L)
  275.       return -1L;    // error, not enough memory
  276.    pparam->cb = WinQueryPresParam(hwnd, PP_BORDERCOLOR, PP_BORDERCOLORINDEX,
  277.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  278.    if(pparam->cb)    // was the param found?
  279.    {
  280.       ppresparams->cb += 12L;                      // used 12 bytes
  281.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  282.    }
  283.  
  284.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  285.    // font name & size -- maximum 44 bytes (32 for face name, 4 for point size) + 8 for data
  286.    if((ulBufLen - ppresparams->cb) < 44L)
  287.       return -1L;    // error, not enough memory
  288.    pparam->cb = WinQueryPresParam(hwnd, PP_FONTNAMESIZE, 0L,
  289.                                   &pparam->id, 36L, (PVOID)pparam->ab, QPF_NOINHERIT);
  290.    if(pparam->cb)    // was the param found?
  291.    {
  292.       ppresparams->cb += (pparam->cb + 8L);                    // used cb + 8 bytes
  293.       pparam = (PPARAM)(((ULONG)pparam) + pparam->cb + 8L);    // advance to next memory location
  294.    }
  295.  
  296.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  297.    // active color -- takes 12 bytes
  298.    if((ulBufLen - ppresparams->cb) < 12L)
  299.       return -1L;    // error, not enough memory
  300.    pparam->cb = WinQueryPresParam(hwnd, PP_ACTIVECOLOR, PP_ACTIVECOLORINDEX,
  301.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  302.    if(pparam->cb)    // was the param found?
  303.    {
  304.       ppresparams->cb += 12L;                      // used 12 bytes
  305.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  306.    }
  307.  
  308.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  309.    // inactive color -- takes 12 bytes
  310.    if((ulBufLen - ppresparams->cb) < 12L)
  311.       return -1L;    // error, not enough memory
  312.    pparam->cb = WinQueryPresParam(hwnd, PP_INACTIVECOLOR, PP_INACTIVECOLORINDEX,
  313.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  314.    if(pparam->cb)    // was the param found?
  315.    {
  316.       ppresparams->cb += 12L;                      // used 12 bytes
  317.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  318.    }
  319.  
  320.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  321.    // active text foreground color -- takes 12 bytes
  322.    if((ulBufLen - ppresparams->cb) < 12L)
  323.       return -1L;    // error, not enough memory
  324.    pparam->cb = WinQueryPresParam(hwnd, PP_ACTIVETEXTFGNDCOLOR, PP_ACTIVETEXTFGNDCOLORINDEX,
  325.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT | QPF_PURERGBCOLOR);
  326.    if(pparam->cb)    // was the param found?
  327.    {
  328.       ppresparams->cb += 12L;                      // used 12 bytes
  329.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  330.    }
  331.  
  332.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  333.    // active text background color -- takes 12 bytes
  334.    if((ulBufLen - ppresparams->cb) < 12L)
  335.       return -1L;    // error, not enough memory
  336.    pparam->cb = WinQueryPresParam(hwnd, PP_ACTIVETEXTBGNDCOLOR, PP_ACTIVETEXTBGNDCOLORINDEX,
  337.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT | QPF_PURERGBCOLOR);
  338.    if(pparam->cb)    // was the param found?
  339.    {
  340.       ppresparams->cb += 12L;                      // used 12 bytes
  341.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  342.    }
  343.  
  344.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  345.    // inactive text foreground color -- takes 12 bytes
  346.    if((ulBufLen - ppresparams->cb) < 12L)
  347.       return -1L;    // error, not enough memory
  348.    pparam->cb = WinQueryPresParam(hwnd, PP_INACTIVETEXTFGNDCOLOR, PP_INACTIVETEXTFGNDCOLORINDEX,
  349.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT | QPF_PURERGBCOLOR);
  350.    if(pparam->cb)    // was the param found?
  351.    {
  352.       ppresparams->cb += 12L;                      // used 12 bytes
  353.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  354.    }
  355.  
  356.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  357.    // inactive text background color -- takes 12 bytes
  358.    if((ulBufLen - ppresparams->cb) < 12L)
  359.       return -1L;    // error, not enough memory
  360.    pparam->cb = WinQueryPresParam(hwnd, PP_INACTIVETEXTBGNDCOLOR, PP_INACTIVETEXTBGNDCOLORINDEX,
  361.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT | QPF_PURERGBCOLOR);
  362.    if(pparam->cb)    // was the param found?
  363.    {
  364.       ppresparams->cb += 12L;                      // used 12 bytes
  365.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  366.    }
  367.  
  368.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  369.    // shadow color -- takes 12 bytes
  370.    if((ulBufLen - ppresparams->cb) < 12L)
  371.       return -1L;    // error, not enough memory
  372.    pparam->cb = WinQueryPresParam(hwnd, PP_SHADOW, 0L,
  373.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  374.    if(pparam->cb)    // was the param found?
  375.    {
  376.       ppresparams->cb += 12L;                      // used 12 bytes
  377.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  378.    }
  379.  
  380.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  381.    // menu foreground color -- takes 12 bytes
  382.    if((ulBufLen - ppresparams->cb) < 12L)
  383.       return -1L;    // error, not enough memory
  384.    pparam->cb = WinQueryPresParam(hwnd, PP_MENUFOREGROUNDCOLOR, PP_MENUFOREGROUNDCOLORINDEX,
  385.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  386.    if(pparam->cb)    // was the param found?
  387.    {
  388.       ppresparams->cb += 12L;                      // used 12 bytes
  389.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  390.    }
  391.  
  392.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  393.    // menu background color -- takes 12 bytes
  394.    if((ulBufLen - ppresparams->cb) < 12L)
  395.       return -1L;    // error, not enough memory
  396.    pparam->cb = WinQueryPresParam(hwnd, PP_MENUBACKGROUNDCOLOR, PP_MENUBACKGROUNDCOLORINDEX,
  397.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  398.    if(pparam->cb)    // was the param found?
  399.    {
  400.       ppresparams->cb += 12L;                      // used 12 bytes
  401.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  402.    }
  403.  
  404.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  405.    // menu hilite foreground color -- takes 12 bytes
  406.    if((ulBufLen - ppresparams->cb) < 12L)
  407.       return -1L;    // error, not enough memory
  408.    pparam->cb = WinQueryPresParam(hwnd, PP_MENUHILITEFGNDCOLOR, PP_MENUHILITEFGNDCOLORINDEX,
  409.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  410.    if(pparam->cb)    // was the param found?
  411.    {
  412.       ppresparams->cb += 12L;                      // used 12 bytes
  413.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  414.    }
  415.  
  416.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  417.    // menu hilite background color -- takes 12 bytes
  418.    if((ulBufLen - ppresparams->cb) < 12L)
  419.       return -1L;    // error, not enough memory
  420.    pparam->cb = WinQueryPresParam(hwnd, PP_MENUHILITEBGNDCOLOR, PP_MENUHILITEBGNDCOLORINDEX,
  421.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  422.    if(pparam->cb)    // was the param found?
  423.    {
  424.       ppresparams->cb += 12L;                      // used 12 bytes
  425.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  426.    }
  427.  
  428.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  429.    // menu disabled foreground color -- takes 12 bytes
  430.    if((ulBufLen - ppresparams->cb) < 12L)
  431.       return -1L;    // error, not enough memory
  432.    pparam->cb = WinQueryPresParam(hwnd, PP_MENUDISABLEDFGNDCOLOR, PP_MENUDISABLEDFGNDCOLORINDEX,
  433.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  434.    if(pparam->cb)    // was the param found?
  435.    {
  436.       ppresparams->cb += 12L;                      // used 12 bytes
  437.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  438.    }
  439.  
  440.    // ────────────────────────────────────────────────────────────────────────────────────────────────
  441.    // menu disabled background color -- takes 12 bytes
  442.    if((ulBufLen - ppresparams->cb) < 12L)
  443.       return -1L;    // error, not enough memory
  444.    pparam->cb = WinQueryPresParam(hwnd, PP_MENUDISABLEDBGNDCOLOR, PP_MENUDISABLEDBGNDCOLORINDEX,
  445.                                   &pparam->id, sizeof(LONG), (PVOID)pparam->ab, QPF_NOINHERIT);
  446.    if(pparam->cb)    // was the param found?
  447.    {
  448.       ppresparams->cb += 12L;                      // used 12 bytes
  449.       pparam = (PPARAM)(((ULONG)pparam) + 12L);    // advance 12 bytes to next memory location
  450.    }
  451.  
  452.  
  453.    return 0L;     // success, no message to return
  454. }
  455.  
  456.  
  457.  
  458.