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.

129 lines
3.2 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996-1998 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // AtlUtil.h
  7. //
  8. // Abstract:
  9. // Definitions of helper functions for use in an ATL project.
  10. //
  11. // Implementation File:
  12. // AtlUtils.cpp
  13. //
  14. // Author:
  15. // David Potter (davidp) December 11, 1997
  16. //
  17. // Revision History:
  18. //
  19. // Notes:
  20. //
  21. /////////////////////////////////////////////////////////////////////////////
  22. #ifndef __ATLUTIL_H_
  23. #define __ATLUTIL_H_
  24. /////////////////////////////////////////////////////////////////////////////
  25. // Forward Class Declarations
  26. /////////////////////////////////////////////////////////////////////////////
  27. /////////////////////////////////////////////////////////////////////////////
  28. // External Class Declarations
  29. /////////////////////////////////////////////////////////////////////////////
  30. /////////////////////////////////////////////////////////////////////////////
  31. // Include Files
  32. /////////////////////////////////////////////////////////////////////////////
  33. /////////////////////////////////////////////////////////////////////////////
  34. // Global Function Prototypes
  35. /////////////////////////////////////////////////////////////////////////////
  36. // Get a text value from a control on a dialog
  37. BOOL DDX_GetText(
  38. IN HWND hwndDlg,
  39. IN int nIDC,
  40. IN OUT CString & rstrValue
  41. );
  42. // Set a text value into a control on a dialog
  43. BOOL DDX_SetText(
  44. IN HWND hwndDlg,
  45. IN int nIDC,
  46. IN const CString & rstrValue
  47. );
  48. // Set a text value into a combobox control on a dialog
  49. BOOL DDX_SetComboBoxText(
  50. IN HWND hwndDlg,
  51. IN int nIDC,
  52. IN const CString & rstrValue,
  53. IN BOOL bRequired = FALSE
  54. );
  55. // Get a numeric value from a control on a dialog
  56. BOOL DDX_GetNumber(
  57. IN HWND hwndDlg,
  58. IN int nIDC,
  59. IN OUT ULONG & rnValue,
  60. IN ULONG nMin,
  61. IN ULONG nMax,
  62. IN BOOL bSigned
  63. );
  64. // Get a numeric value from a control on a dialog
  65. inline BOOL DDX_GetNumber(
  66. IN HWND hwndDlg,
  67. IN int nIDC,
  68. IN OUT LONG & rnValue,
  69. IN LONG nMin,
  70. IN LONG nMax
  71. )
  72. {
  73. return DDX_GetNumber(
  74. hwndDlg,
  75. nIDC,
  76. reinterpret_cast< ULONG & >( rnValue ),
  77. static_cast< ULONG >( nMin ),
  78. static_cast< ULONG >( nMax ),
  79. TRUE /*bSigned*/
  80. );
  81. } //*** DDX_GetNumber( LONG & )
  82. // Set a numeric value into a control on a dialog dialog
  83. BOOL DDX_SetNumber(
  84. IN HWND hwndDlg,
  85. IN int nIDC,
  86. IN ULONG nValue,
  87. IN ULONG nMin,
  88. IN ULONG nMax,
  89. IN BOOL bSigned
  90. );
  91. // Validate that the dialog string is present
  92. BOOL DDV_RequiredText(
  93. IN HWND hwndDlg,
  94. IN int nIDC,
  95. IN int nIDCLabel,
  96. IN const CString & rstrValue
  97. );
  98. // Get the value of a checkbox
  99. void DDX_GetCheck( IN HWND hwndDlg, IN int nIDC, OUT int & rnValue );
  100. // Set the value of a checkbox
  101. void DDX_SetCheck( IN HWND hwndDlg, IN int nIDC, IN int nValue );
  102. // Get the number of the radio button that is slected in a group
  103. void DDX_GetRadio( IN HWND hwndDlg, IN int nIDC, OUT int & rnValue );
  104. // Set the radio button states in a group
  105. void DDX_SetRadio( IN HWND hwndDlg, IN int nIDC, IN int nValue );
  106. // Remove ampersands and colons from a label
  107. void CleanupLabel( IN OUT LPTSTR psz );
  108. /////////////////////////////////////////////////////////////////////////////
  109. #endif //__ATLUTIL_H_