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.

73 lines
1.3 KiB

  1. #include "shellprv.h"
  2. #include "ids.h"
  3. #include "ctllogic.h"
  4. BOOL _GetListViewSelectedLVITEM(HWND hwndList, LVITEM* plvitem)
  5. {
  6. BOOL fFound = FALSE;
  7. int iCount = ListView_GetItemCount(hwndList);
  8. plvitem->mask |= LVIF_STATE;
  9. plvitem->stateMask = LVIS_SELECTED;
  10. for (int j = 0; j < iCount; ++j)
  11. {
  12. plvitem->iItem = j;
  13. ListView_GetItem(hwndList, plvitem);
  14. if (plvitem->state & LVIS_SELECTED)
  15. {
  16. fFound = TRUE;
  17. break;
  18. }
  19. }
  20. return fFound;
  21. }
  22. HRESULT _GetListViewSelectedLPARAM(HWND hwndList, LPARAM* plparam)
  23. {
  24. HRESULT hr;
  25. LVITEM lvitem = {0};
  26. lvitem.mask = LVIF_PARAM;
  27. if (_GetListViewSelectedLVITEM(hwndList, &lvitem))
  28. {
  29. hr = S_OK;
  30. *plparam = lvitem.lParam;
  31. }
  32. else
  33. {
  34. hr = S_FALSE;
  35. *plparam = NULL;
  36. }
  37. return hr;
  38. }
  39. // ComboBox
  40. HRESULT _GetComboBoxSelectedLRESULT(HWND hwndComboBox, LRESULT* plr)
  41. {
  42. HRESULT hr;
  43. int iCurSel = ComboBox_GetCurSel(hwndComboBox);
  44. LRESULT lr = ComboBox_GetItemData(hwndComboBox, iCurSel);
  45. if (CB_ERR != lr)
  46. {
  47. hr = S_OK;
  48. *plr = lr;
  49. }
  50. else
  51. {
  52. hr = S_FALSE;
  53. *plr = NULL;
  54. }
  55. return hr;
  56. }