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.

158 lines
4.1 KiB

  1. // FileSpyView.cpp : implementation of the CFileSpyView class
  2. //
  3. #include "stdafx.h"
  4. #include "FileSpyApp.h"
  5. #include "FileSpyDoc.h"
  6. #include "FileSpyView.h"
  7. #include "global.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CFileSpyView
  15. IMPLEMENT_DYNCREATE(CFileSpyView, CListView)
  16. BEGIN_MESSAGE_MAP(CFileSpyView, CListView)
  17. //{{AFX_MSG_MAP(CFileSpyView)
  18. ON_WM_KEYDOWN()
  19. //}}AFX_MSG_MAP
  20. END_MESSAGE_MAP()
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CFileSpyView construction/destruction
  23. CFileSpyView::CFileSpyView()
  24. {
  25. // TODO: add construction code here
  26. pSpyView = (LPVOID) this;
  27. }
  28. CFileSpyView::~CFileSpyView()
  29. {
  30. }
  31. BOOL CFileSpyView::PreCreateWindow(CREATESTRUCT& cs)
  32. {
  33. // TODO: Modify the Window class or styles here by modifying
  34. // the CREATESTRUCT cs
  35. cs.style |= LVS_REPORT | WS_HSCROLL | WS_VSCROLL;
  36. return CListView::PreCreateWindow(cs);
  37. }
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CFileSpyView drawing
  40. void CFileSpyView::OnDraw(CDC* pDC)
  41. {
  42. UNREFERENCED_PARAMETER( pDC );
  43. CFileSpyDoc* pDoc = GetDocument();
  44. ASSERT_VALID(pDoc);
  45. CListCtrl& refCtrl = GetListCtrl();
  46. refCtrl.InsertItem(0, L"Item!");
  47. // TODO: add draw code for native data here
  48. }
  49. void CFileSpyView::OnInitialUpdate()
  50. {
  51. CListView::OnInitialUpdate();
  52. // TODO: You may populate your ListView with items by directly accessing
  53. // its list control through a call to GetListCtrl().
  54. //
  55. // Add the list header items
  56. //
  57. GetListCtrl().InsertColumn(0, L"S. No", LVCFMT_LEFT, 50);
  58. GetListCtrl().InsertColumn(1, L"Major Code", LVCFMT_LEFT, 100);
  59. GetListCtrl().InsertColumn(2, L"Minor Code", LVCFMT_LEFT, 100);
  60. GetListCtrl().InsertColumn(3, L"FileObject", LVCFMT_LEFT, 75);
  61. GetListCtrl().InsertColumn(4, L"Name", LVCFMT_LEFT, 250);
  62. GetListCtrl().InsertColumn(5, L"Process:Thread", LVCFMT_LEFT, 100);
  63. GetListCtrl().InsertColumn(6, L"OrgnTime", LVCFMT_LEFT, 78);
  64. GetListCtrl().InsertColumn(7, L"CompTime", LVCFMT_LEFT, 78);
  65. GetListCtrl().InsertColumn(8, L"Flags", LVCFMT_LEFT, 175);
  66. GetListCtrl().InsertColumn(9, L"Status:RetInfo", LVCFMT_LEFT, 100);
  67. }
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CFileSpyView diagnostics
  70. #ifdef _DEBUG
  71. void CFileSpyView::AssertValid() const
  72. {
  73. CListView::AssertValid();
  74. }
  75. void CFileSpyView::Dump(CDumpContext& dc) const
  76. {
  77. CListView::Dump(dc);
  78. }
  79. CFileSpyDoc* CFileSpyView::GetDocument() // non-debug version is inline
  80. {
  81. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFileSpyDoc)));
  82. return (CFileSpyDoc*)m_pDocument;
  83. }
  84. #endif //_DEBUG
  85. /////////////////////////////////////////////////////////////////////////////
  86. // CFileSpyView message handlers
  87. void CFileSpyView::OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct)
  88. {
  89. //TODO: add code to react to the user changing the view style of your window
  90. UNREFERENCED_PARAMETER( nStyleType );
  91. UNREFERENCED_PARAMETER( lpStyleStruct );
  92. }
  93. void CFileSpyView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
  94. {
  95. // TODO: Add your specialized code here and/or call the base class
  96. UNREFERENCED_PARAMETER( pSender );
  97. UNREFERENCED_PARAMETER( lHint );
  98. UNREFERENCED_PARAMETER( pHint );
  99. }
  100. void CFileSpyView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
  101. {
  102. // TODO: Add your message handler code here and/or call default
  103. int ti, oldti;
  104. if (nChar == VK_DELETE)
  105. {
  106. ti = 0;
  107. oldti = 0;
  108. while(ti < GetListCtrl().GetItemCount())
  109. {
  110. if (GetListCtrl().GetItemState(ti, LVIS_SELECTED) & LVIS_SELECTED)
  111. {
  112. GetListCtrl().DeleteItem(ti);
  113. oldti = ti;
  114. }
  115. else
  116. {
  117. ti++;
  118. }
  119. }
  120. if (oldti < GetListCtrl().GetItemCount())
  121. {
  122. GetListCtrl().SetItemState(oldti, LVIS_SELECTED, LVIS_SELECTED);
  123. }
  124. else
  125. {
  126. GetListCtrl().SetItemState(oldti-1, LVIS_SELECTED, LVIS_SELECTED);
  127. }
  128. }
  129. CListView::OnKeyDown(nChar, nRepCnt, nFlags);
  130. }