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.

232 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. fdhelp.c
  5. Abstract:
  6. Routines to support context-sensitive help in the disk manager.
  7. Author:
  8. Ted Miller (tedm) 18-March-1992
  9. Revision History:
  10. --*/
  11. #include "fdisk.h"
  12. //
  13. // Define macro to convert between a menu id and its corresponding
  14. // context-sensitive help id, in a switch statement.
  15. //
  16. #define MENUID_TO_HELPID(name) case IDM_##name : \
  17. HelpContext = HC_DM_MENU_##name; \
  18. break;
  19. //
  20. // Current help context
  21. //
  22. DWORD HelpContext = (DWORD)(-1);
  23. //
  24. // Handle to windows hook for F1 key
  25. //
  26. HHOOK hHook;
  27. DWORD
  28. HookProc(
  29. IN int nCode,
  30. IN UINT wParam,
  31. IN LONG lParam
  32. )
  33. /*++
  34. Routine Description:
  35. Hook proc to detect F1 key presses.
  36. Arguments:
  37. Return Value:
  38. --*/
  39. {
  40. PMSG pmsg = (PMSG)lParam;
  41. if(nCode < 0) {
  42. return(CallNextHookEx(hHook,nCode,wParam,lParam));
  43. }
  44. if(((nCode == MSGF_DIALOGBOX) || (nCode == MSGF_MENU))
  45. && (pmsg->message == WM_KEYDOWN)
  46. && (LOWORD(pmsg->wParam) == VK_F1))
  47. {
  48. PostMessage(hwndFrame,WM_F1DOWN,nCode,0);
  49. return(TRUE);
  50. }
  51. return(FALSE);
  52. }
  53. VOID
  54. Help(
  55. IN LONG Code
  56. )
  57. /*++
  58. Routine Description:
  59. Display context-sensitive help.
  60. Arguments:
  61. Code - supplies type of message (MSGF_DIALOGBOX, MSGF_MENU, etc).
  62. Return Value:
  63. None.
  64. --*/
  65. {
  66. UNREFERENCED_PARAMETER(Code);
  67. if(HelpContext != -1) {
  68. WinHelp(hwndFrame,HelpFile,HELP_CONTEXT,HelpContext);
  69. DrawMenuBar(hwndFrame);
  70. }
  71. }
  72. VOID
  73. DialogHelp(
  74. IN DWORD HelpId
  75. )
  76. /*++
  77. Routine Description:
  78. Display help on a specific item.
  79. Arguments:
  80. HelpId -- Supplies the help item to display.
  81. Return Value:
  82. None.
  83. --*/
  84. {
  85. WinHelp(hwndFrame,HelpFile,HELP_CONTEXT,HelpId);
  86. DrawMenuBar(hwndFrame);
  87. }
  88. VOID
  89. SetMenuItemHelpContext(
  90. IN LONG wParam,
  91. IN DWORD lParam
  92. )
  93. /*++
  94. Routine Description:
  95. Routine to set help context based on which menu item is currently
  96. selected.
  97. Arguments:
  98. wParam,lParam - params to window proc in WM_MENUSELECT case
  99. Return Value:
  100. None.
  101. --*/
  102. {
  103. if(HIWORD(lParam) == 0) { // menu closed
  104. HelpContext = (DWORD)(-1);
  105. } else if (HIWORD(wParam) & MF_POPUP) { // popup selected
  106. HelpContext = (DWORD)(-1);
  107. } else { // regular old menu item
  108. switch(LOWORD(wParam)) {
  109. MENUID_TO_HELPID(PARTITIONCREATE)
  110. MENUID_TO_HELPID(PARTITIONCREATEEX)
  111. MENUID_TO_HELPID(PARTITIONDELETE)
  112. #if i386
  113. MENUID_TO_HELPID(PARTITIONACTIVE)
  114. #else
  115. MENUID_TO_HELPID(SECURESYSTEM)
  116. #endif
  117. MENUID_TO_HELPID(PARTITIONLETTER)
  118. MENUID_TO_HELPID(PARTITIONEXIT)
  119. MENUID_TO_HELPID(CONFIGMIGRATE)
  120. MENUID_TO_HELPID(CONFIGSAVE)
  121. MENUID_TO_HELPID(CONFIGRESTORE)
  122. MENUID_TO_HELPID(FTESTABLISHMIRROR)
  123. MENUID_TO_HELPID(FTBREAKMIRROR)
  124. MENUID_TO_HELPID(FTCREATESTRIPE)
  125. MENUID_TO_HELPID(FTCREATEPSTRIPE)
  126. MENUID_TO_HELPID(FTCREATEVOLUMESET)
  127. MENUID_TO_HELPID(FTEXTENDVOLUMESET)
  128. MENUID_TO_HELPID(FTRECOVERSTRIPE)
  129. MENUID_TO_HELPID(OPTIONSSTATUS)
  130. MENUID_TO_HELPID(OPTIONSLEGEND)
  131. MENUID_TO_HELPID(OPTIONSCOLORS)
  132. MENUID_TO_HELPID(OPTIONSDISPLAY)
  133. MENUID_TO_HELPID(HELPCONTENTS)
  134. MENUID_TO_HELPID(HELPSEARCH)
  135. MENUID_TO_HELPID(HELPHELP)
  136. MENUID_TO_HELPID(HELPABOUT)
  137. default:
  138. HelpContext = (DWORD)(-1);
  139. }
  140. }
  141. }
  142. VOID
  143. InitHelp(
  144. VOID
  145. )
  146. {
  147. hHook = SetWindowsHookEx(WH_MSGFILTER,(HOOKPROC)HookProc,NULL,GetCurrentThreadId());
  148. }
  149. VOID
  150. TermHelp(
  151. VOID
  152. )
  153. {
  154. UnhookWindowsHookEx(hHook);
  155. }