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

  1. /* PL_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. **                  path  = a pointer to a PATH data structure
  11. **
  12. **      Returns:    TRUE upon success, or FALSE if an error exists.
  13. **
  14. **      Notes:      Use these functions with the PathTab ListView
  15. **                  control.
  16. */
  17.  
  18. #include "AppPaths.h"
  19.  
  20. extern BOOL far PL_GetItem (HWND list,int index,LPPATH path)
  21. {
  22.     ListView_GetItemText (list,index,COLUMN_1,path->name,PSTRING);
  23.     ListView_GetItemText (list,index,COLUMN_2,path->application,PSTRING);
  24.     ListView_GetItemText (list,index,COLUMN_3,path->path,KSTRING);
  25.  
  26.     path->index = index;
  27.  
  28.     return (TRUE);
  29. }
  30.  
  31. extern BOOL far PL_PutItem (HWND list,int index,LPPATH path)
  32. {
  33.     ListView_SetItemText (list,index,COLUMN_1,path->name);
  34.     ListView_SetItemText (list,index,COLUMN_2,path->application);
  35.     ListView_SetItemText (list,index,COLUMN_3,path->path);
  36.  
  37.     path->index = index;
  38.  
  39.     return (TRUE);
  40. }
  41.  
  42. extern BOOL far PL_AddItem (HWND list,LPPATH path)
  43. {
  44.     auto int        index   = ListView_GetItemCount (list);
  45.     auto LV_ITEM    item    = { NIL };
  46.  
  47.     item.mask       = LVIF_TEXT;
  48.     item.iItem      = index;
  49.     item.iSubItem   = COLUMN_1;
  50.     item.pszText    = path->name;
  51.  
  52.     ListView_InsertItem  (list,&item);
  53.     ListView_SetItemText (list,index,COLUMN_2,path->application);
  54.     ListView_SetItemText (list,index,COLUMN_3,path->path);
  55.  
  56.     ListView_EnsureVisible (list,index,FALSE);
  57.     LV_SetCurSel (list,index);
  58.  
  59.     path->index = index;
  60.  
  61.     return (TRUE);
  62. }
  63.  
  64. /* end of PL_Help.c - written by Gregory Braun */
  65.