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.

132 lines
3.1 KiB

  1. /*****************************************************************************
  2. *
  3. * diqedev.c
  4. *
  5. * The dialog box that modifies device enumeration.
  6. *
  7. *****************************************************************************/
  8. #include "diquick.h"
  9. /*****************************************************************************
  10. *
  11. * DEnum_OnInitDialog
  12. *
  13. * Initialize the enumeration controls based on the current settings.
  14. *
  15. *****************************************************************************/
  16. BOOL INTERNAL
  17. DEnum_OnInitDialog(HWND hdlg)
  18. {
  19. if (g_dwEnumType & DIDEVTYPE_HID) {
  20. CheckDlgButton(hdlg, IDC_ENUMDEV_HID, TRUE);
  21. }
  22. if (g_dwEnumFlags & DIEDFL_ATTACHEDONLY) {
  23. CheckDlgButton(hdlg, IDC_ENUMDEV_ATT, TRUE);
  24. }
  25. if (g_dwEnumFlags & DIEDFL_FORCEFEEDBACK) {
  26. CheckDlgButton(hdlg, IDC_ENUMDEV_FF, TRUE);
  27. }
  28. if (g_dwEnumFlags & DIEDFL_INCLUDEALIASES) {
  29. CheckDlgButton(hdlg, IDC_ENUMDEV_ALIAS, TRUE);
  30. }
  31. if (g_dwEnumFlags & DIEDFL_INCLUDEPHANTOMS) {
  32. CheckDlgButton(hdlg, IDC_ENUMDEV_PHANTOM, TRUE);
  33. }
  34. CheckRadioButton(hdlg, IDC_ENUMDEV_ALL, IDC_ENUMDEV_LAST,
  35. IDC_ENUMDEV_ALL + GET_DIDEVICE_TYPE(g_dwEnumType));
  36. return 1;
  37. }
  38. /*****************************************************************************
  39. *
  40. * DEnum_Apply
  41. *
  42. * pull out the settings and stash them back.
  43. *
  44. *****************************************************************************/
  45. void INTERNAL
  46. DEnum_Apply(HWND hdlg)
  47. {
  48. DWORD dw;
  49. dw = GetCheckedRadioButton(hdlg, IDC_ENUMDEV_ALL, IDC_ENUMDEV_LAST) -
  50. IDC_ENUMDEV_ALL;
  51. if (IsDlgButtonChecked(hdlg, IDC_ENUMDEV_HID)) {
  52. dw |= DIDEVTYPE_HID;
  53. }
  54. g_dwEnumType = dw;
  55. dw = 0;
  56. if (IsDlgButtonChecked(hdlg, IDC_ENUMDEV_ATT)) {
  57. dw |= DIEDFL_ATTACHEDONLY;
  58. }
  59. if (IsDlgButtonChecked(hdlg, IDC_ENUMDEV_FF)) {
  60. dw |= DIEDFL_FORCEFEEDBACK;
  61. }
  62. if (IsDlgButtonChecked(hdlg, IDC_ENUMDEV_ALIAS)) {
  63. dw |= DIEDFL_INCLUDEALIASES;
  64. }
  65. if (IsDlgButtonChecked(hdlg, IDC_ENUMDEV_PHANTOM)) {
  66. dw |= DIEDFL_INCLUDEPHANTOMS;
  67. }
  68. g_dwEnumFlags = dw;
  69. }
  70. /*****************************************************************************
  71. *
  72. * DEnum_OnCommand
  73. *
  74. *****************************************************************************/
  75. BOOL INLINE
  76. DEnum_OnCommand(HWND hdlg, int id, UINT cmd)
  77. {
  78. switch (id) {
  79. case IDOK: DEnum_Apply(hdlg); EndDialog(hdlg, 1); return TRUE;
  80. case IDCANCEL: EndDialog(hdlg, 0); return TRUE;
  81. }
  82. return FALSE;
  83. }
  84. /*****************************************************************************
  85. *
  86. * DEnum_DlgProc
  87. *
  88. *****************************************************************************/
  89. INT_PTR EXTERNAL
  90. DEnum_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp)
  91. {
  92. switch (wm) {
  93. case WM_INITDIALOG:
  94. return DEnum_OnInitDialog(hdlg);
  95. case WM_COMMAND:
  96. return DEnum_OnCommand(hdlg,
  97. (int)GET_WM_COMMAND_ID(wp, lp),
  98. (UINT)GET_WM_COMMAND_CMD(wp, lp));
  99. }
  100. return 0;
  101. }