Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.3 KiB

  1. /* File: \WACKER\TDLL\hlptable.c (Created: 4-30-1998)
  2. *
  3. * Copyright 1998 by Hilgraeve Inc. -- Monroe, MI
  4. * All rights reserved
  5. *
  6. * $Revision: 4 $
  7. * $Date: 5/25/99 8:55a $
  8. */
  9. #include <windows.h>
  10. #pragma hdrstop
  11. #include "globals.h"
  12. #include "hlptable.h"
  13. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  14. * FUNCTION:
  15. * doContextHelp
  16. *
  17. * DESCRIPTION:
  18. *
  19. * ARGUMENTS:
  20. *
  21. * RETURNS:
  22. * BOOL
  23. *
  24. */
  25. void doContextHelp(const DWORD aHlpTable[], WPARAM wPar, LPARAM lPar, BOOL bContext, BOOL bForce)
  26. {
  27. if ( !bContext )
  28. {
  29. if ( isControlinHelpTable( aHlpTable, ((LPHELPINFO)lPar)->iCtrlId ) || bForce )
  30. {
  31. if ( ((LPHELPINFO)lPar)->iCtrlId == IDOK || ((LPHELPINFO)lPar)->iCtrlId == IDCANCEL )
  32. {
  33. WinHelp(((LPHELPINFO)lPar)->hItemHandle,
  34. TEXT("windows.hlp"),
  35. HELP_WM_HELP,
  36. (DWORD_PTR)(LPTSTR)aHlpTable);
  37. }
  38. else
  39. {
  40. WinHelp(((LPHELPINFO)lPar)->hItemHandle,
  41. glblQueryHelpFileName(),
  42. HELP_WM_HELP,
  43. (DWORD_PTR)(LPTSTR)aHlpTable);
  44. }
  45. }
  46. }
  47. else
  48. {
  49. if ( isControlinHelpTable( aHlpTable, GetDlgCtrlID((HWND)wPar)) || bForce )
  50. {
  51. if ( GetDlgCtrlID((HWND)wPar) == IDOK || GetDlgCtrlID((HWND)wPar) == IDCANCEL )
  52. {
  53. WinHelp((HWND)wPar,
  54. TEXT("windows.hlp"),
  55. HELP_CONTEXTMENU,
  56. (DWORD_PTR)(LPTSTR)aHlpTable);
  57. }
  58. else
  59. {
  60. if ( GetDlgCtrlID( (HWND)wPar ) )
  61. {
  62. WinHelp((HWND)wPar,
  63. glblQueryHelpFileName(),
  64. HELP_CONTEXTMENU,
  65. (DWORD_PTR)(LPTSTR)aHlpTable);
  66. }
  67. }
  68. }
  69. }
  70. }
  71. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  72. * FUNCTION:
  73. * isControlinHelpTable
  74. *
  75. * DESCRIPTION:
  76. * Let's us decide whether or not to call WinHelp (HTMLHelp) based on
  77. * whether or not the specified control is matched to a help id.
  78. *
  79. * ARGUMENTS:
  80. *
  81. * RETURNS:
  82. * BOOL
  83. *
  84. */
  85. BOOL isControlinHelpTable(const DWORD aHlpTable[], const INT cntrlID)
  86. {
  87. INT nLoop;
  88. BOOL retval = FALSE;
  89. for(nLoop = 0; aHlpTable[nLoop] != (DWORD)0; nLoop++)
  90. {
  91. if ( aHlpTable[nLoop] == (DWORD)cntrlID )
  92. {
  93. retval = TRUE;
  94. break;
  95. }
  96. }
  97. return retval;
  98. }