home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / Chip_2002-02_cd1.bin / sharewar / apaths / APSOURCE.ZIP / HL_Help.c < prev    next >
C/C++ Source or Header  |  2001-03-26  |  2KB  |  63 lines

  1. /* HL_Help - March 26th, 2001
  2. **
  3. **      Copyright (c) 1997-2001 by Gregory Braun. All rights reserved.
  4. **
  5. **      This module contains functions to facilitate simple ListView
  6. **      data access.
  7. **
  8. **      Called:     list  = handle to the ListView control.
  9. **                  index = list item index (zero-based).
  10. **                  help  = a pointer to a HELP data structure
  11. **
  12. **      Returns:    TRUE upon success, or FALSE if an error exists.
  13. **
  14. **      Notes:      Use these functions with the HelpTab ListView
  15. **                  control.
  16. */
  17.  
  18. #include "AppPaths.h"
  19.  
  20. extern BOOL far HL_GetItem (HWND list,int index,LPHELP help)
  21. {
  22.     ListView_GetItemText (list,index,COLUMN_1,help->name,PSTRING);
  23.     ListView_GetItemText (list,index,COLUMN_2,help->path,PSTRING);
  24.  
  25.     help->index = index;
  26.  
  27.     return (TRUE);
  28. }
  29.  
  30. extern BOOL far HL_PutItem (HWND list,int index,LPHELP help)
  31. {
  32.     ListView_SetItemText (list,index,COLUMN_1,help->name);
  33.     ListView_SetItemText (list,index,COLUMN_2,help->path);
  34.  
  35.     help->index = index;
  36.  
  37.     return (TRUE);
  38. }
  39.  
  40. extern BOOL far HL_AddItem (HWND list,LPHELP help)
  41. {
  42.     auto int        index   = ListView_GetItemCount (list);
  43.     auto LV_ITEM    item    = { NIL };
  44.  
  45.     item.mask       = LVIF_TEXT;
  46.     item.iItem      = index;
  47.     item.iSubItem   = COLUMN_1;
  48.     item.pszText    = help->name;
  49.  
  50.     ListView_InsertItem  (list,&item);
  51.     ListView_SetItemText (list,index,COLUMN_2,help->path);
  52.  
  53.     ListView_EnsureVisible (list,index,FALSE);
  54.     LV_SetCurSel (list,index);
  55.  
  56.     help->index = index;
  57.  
  58.     return (TRUE);
  59. }
  60.  
  61. /* end of HL_Help.c - written by Gregory Braun */
  62.  
  63.