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
2.0 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 1998
  4. *
  5. * TITLE: SITEMLST.H
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: ShaunIv
  10. *
  11. * DATE: 10/7/1999
  12. *
  13. * DESCRIPTION: Scan Item List
  14. *
  15. *******************************************************************************/
  16. #ifndef __SITEMLST_H_INCLUDED
  17. #define __SITEMLST_H_INCLUDED
  18. #include <windows.h>
  19. #include "wia.h"
  20. #include "simlist.h"
  21. #include "scanitem.h"
  22. class CScanItemList : public CSimpleLinkedList<CScannerItem>
  23. {
  24. public:
  25. CScanItemList( IWiaItem *pRootItem = NULL )
  26. {
  27. Enumerate(pRootItem);
  28. }
  29. Iterator CurrentItem(void) const
  30. {
  31. return Begin();
  32. }
  33. HRESULT Enumerate( IWiaItem *pRootItem )
  34. {
  35. WIA_PUSH_FUNCTION((TEXT("CScanItemList::Enumerate(%p)"),pRootItem));
  36. HRESULT hr = E_FAIL;
  37. if (pRootItem)
  38. {
  39. CComPtr<IEnumWiaItem> pIEnumWiaItem;
  40. hr = pRootItem->EnumChildItems(&pIEnumWiaItem);
  41. if (SUCCEEDED(hr))
  42. {
  43. ULONG cFetched=0;
  44. while (hr == S_OK)
  45. {
  46. IWiaItem *pItem = NULL;
  47. hr = pIEnumWiaItem->Next(1, &pItem, &cFetched);
  48. if (SUCCEEDED(hr))
  49. {
  50. if (hr == S_OK)
  51. {
  52. WIA_TRACE((TEXT("Calling Append on (%p)"),pItem));
  53. Append(CScannerItem(pItem));
  54. }
  55. }
  56. else
  57. {
  58. WIA_ERROR((TEXT("pIEnumWiaItem->Next failed")));
  59. }
  60. }
  61. }
  62. else
  63. {
  64. WIA_ERROR((TEXT("EnumRootItems failed")));
  65. }
  66. }
  67. return(hr);
  68. }
  69. };
  70. #endif // __SITEMLST_H_INCLUDED