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.

83 lines
2.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994.
  5. //
  6. // File: cproppg.cxx
  7. //
  8. // Contents:
  9. //
  10. // Classes: CHlprPropPage
  11. //
  12. // Functions: DialogProc
  13. //
  14. // History: 4-12-1994 stevebl original dialog box helpers Created
  15. // 4-29-1998 stevebl Modified from dialog box helpers
  16. //
  17. //----------------------------------------------------------------------------
  18. #include "main.h"
  19. #include "cproppg.h"
  20. HPROPSHEETPAGE CHlprPropPage::CreatePropertySheetPage(LPPROPSHEETPAGE lppsp)
  21. {
  22. lppsp->pfnDlgProc = HlprPropPageDialogProc;
  23. lppsp->lParam = (LPARAM)(CHlprPropPage *) this;
  24. return ::CreatePropertySheetPage(lppsp);
  25. }
  26. //+---------------------------------------------------------------------------
  27. //
  28. // Function: DialogProc
  29. //
  30. // Synopsis: Common DialogProc used by all CHlprPropPage class objects.
  31. //
  32. // Arguments: [hwndDlg] - handle of dialog box
  33. // [uMsg] - message
  34. // [wParam] - first message parameter
  35. // [lParam] - second message parameter
  36. //
  37. // Returns: response from the CHlprPropPage::DialogProc method
  38. //
  39. // History: 4-12-94 stevebl Created
  40. //
  41. // Notes: This procedure is the DialogProc registered for all dialogs
  42. // created with the CHlprPropPage class. It uses the parameter
  43. // passed with the WM_INITDIALOG message to identify the dialog
  44. // classes' "this" pointer which it then stores in the window
  45. // structure's GWL_USERDATA field. All subsequent messages
  46. // can then be forwarded on to the correct dialog class's
  47. // DialogProc method by using the pointer stored in the
  48. // GWL_USERDATA field.
  49. //
  50. //----------------------------------------------------------------------------
  51. INT_PTR CALLBACK HlprPropPageDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  52. {
  53. CHlprPropPage * pdlg;
  54. switch (uMsg)
  55. {
  56. case WM_INITDIALOG:
  57. // This message is how we identify the dialog object.
  58. // get a pointer to the window class object
  59. pdlg = (CHlprPropPage *) ((PROPSHEETPAGE *)lParam)->lParam;
  60. // set its USERDATA word to point to the class object
  61. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdlg);
  62. break;
  63. default:
  64. // get a pointer to the window class object
  65. pdlg = (CHlprPropPage *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  66. break;
  67. }
  68. // and call its message proc method
  69. if (pdlg != (CHlprPropPage *) 0)
  70. {
  71. return(pdlg->DialogProc(hwndDlg, uMsg, wParam, lParam));
  72. }
  73. else
  74. {
  75. return(FALSE);
  76. }
  77. }