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.

93 lines
1.4 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. Listview.cpp
  5. Abstract:
  6. Manages the list view.
  7. Notes:
  8. Unicode only.
  9. History:
  10. 05/04/2001 rparsons Created
  11. 01/11/2002 rparsons Cleaned up
  12. --*/
  13. #include "precomp.h"
  14. extern APPINFO g_ai;
  15. /*++
  16. Routine Description:
  17. Initializes the list view column.
  18. Arguments:
  19. None.
  20. Return Value:
  21. -1 on failure.
  22. --*/
  23. int
  24. InitListViewColumn(
  25. void
  26. )
  27. {
  28. LVCOLUMN lvc;
  29. lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
  30. lvc.iSubItem = 0;
  31. lvc.pszText = (LPWSTR)L"Messages";
  32. lvc.cx = 555;
  33. return (ListView_InsertColumn(g_ai.hWndList, 1, &lvc));
  34. }
  35. /*++
  36. Routine Description:
  37. Adds an item to the list view.
  38. Arguments:
  39. pwszItemText - Text that belongs to the item.
  40. Return Value:
  41. -1 on failure.
  42. --*/
  43. int
  44. AddListViewItem(
  45. IN LPWSTR pwszItemText
  46. )
  47. {
  48. LVITEM lvi;
  49. int nReturn = 0;
  50. lvi.iItem = ListView_GetItemCount(g_ai.hWndList);
  51. lvi.mask = LVIF_TEXT;
  52. lvi.iSubItem = 0;
  53. lvi.pszText = pwszItemText;
  54. nReturn = ListView_InsertItem(g_ai.hWndList, &lvi);
  55. if (-1 != nReturn) {
  56. ListView_EnsureVisible(g_ai.hWndList, lvi.iItem, FALSE);
  57. }
  58. return nReturn;
  59. }