Source code of Windows XP (NT5)
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.

135 lines
2.6 KiB

  1. #include "precomp.h"
  2. #pragma hdrstop
  3. extern HWND hWndShell;
  4. /* LONG APIENTRY LDefSetupDlgProc(HWND hDlg, UINT wMsg, WORD wParam,
  5. * LPARAM lParam);
  6. *
  7. * Function acts as setup's DefDialogProc(). We use this to process Help and
  8. * Exit button usage so that we don't have to put code into each of our dialog
  9. * procs to do this. The way it works is we filter all the dialog message for
  10. * WM_COMMAND - IDC_H/ID_EXIT messages, these we process right here. The rest
  11. * of the messages are passed on to DefDialogProc().
  12. *
  13. * ENTRY: hDlg - Handle to dialog box who received the focus.
  14. * wMsg - Message.
  15. * wParam - Message dependent.
  16. * lParam - Message dependent.
  17. *
  18. * EXIT:
  19. *
  20. */
  21. INT_PTR APIENTRY
  22. LDefSetupDlgProc(
  23. HWND hDlg,
  24. UINT wMsg,
  25. WPARAM wParam,
  26. LPARAM lParam
  27. )
  28. {
  29. switch(wMsg) {
  30. case WM_KEYDOWN:
  31. switch(wParam) {
  32. case VK_F1:
  33. SendMessage(
  34. hDlg,
  35. WM_COMMAND,
  36. MAKELONG(IDC_H, BN_CLICKED),
  37. lParam
  38. );
  39. return ( 0L );
  40. case VK_F3:
  41. SendMessage(
  42. hDlg,
  43. WM_COMMAND,
  44. MAKELONG(IDC_X, BN_CLICKED),
  45. lParam
  46. );
  47. return ( 0L );
  48. default:
  49. break;
  50. }
  51. break;
  52. case WM_COMMAND:
  53. switch (LOWORD(wParam)) {
  54. case IDC_H:
  55. PostMessage(
  56. hWndShell,
  57. WM_COMMAND,
  58. MAKELONG(ID_HELPBUTTON, BN_CLICKED),
  59. 0L
  60. );
  61. return( 0L );
  62. default:
  63. break;
  64. }
  65. default:
  66. break;
  67. }
  68. return( DefDlgProc( hDlg, wMsg, wParam, lParam ) );
  69. }
  70. BOOL
  71. DlgDefClassInit(
  72. IN HANDLE hInst,
  73. IN BOOL Init
  74. )
  75. {
  76. WNDCLASS wc;
  77. if(Init) {
  78. /* Register setup's own personal dialog class. We do this so that we
  79. * can have generic help and exit buttons on all the setup dialogs
  80. * that need them.
  81. */
  82. wc.hCursor = LoadCursor(NULL,IDC_ARROW);
  83. wc.hIcon = NULL;
  84. wc.lpszMenuName = NULL;
  85. wc.lpszClassName = CLS_MYDLGS;
  86. wc.hbrBackground = NULL;
  87. wc.hInstance = hInst;
  88. wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW | CS_GLOBALCLASS;
  89. wc.lpfnWndProc = LDefSetupDlgProc;
  90. wc.cbClsExtra = 0;
  91. wc.cbWndExtra = DLGWINDOWEXTRA;
  92. return ( RegisterClass(&wc) );
  93. } else {
  94. return(UnregisterClass(CLS_MYDLGS,hInst));
  95. }
  96. }