home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 February
/
Chip_2002-02_cd1.bin
/
sharewar
/
apaths
/
APSOURCE.ZIP
/
LV_Help.c
< prev
next >
Wrap
C/C++ Source or Header
|
2001-03-26
|
1KB
|
60 lines
/* LV_Help - March 26th, 2001
**
** Copyright (c) 1997-2001 by Gregory Braun. All rights reserved.
**
** This module contains functions to facilite simple ListView
** control manipulations.
**
** Called: list = Handle to the ListView control to be used.
** index = List item to be used (zero-based)
**
** Returns: TRUE upon success, or FALSE if an error exists.
*/
#include "AppPaths.h"
extern int far LV_RowHit (HWND list)
{
auto LV_HITTESTINFO hit = { NIL };
GetCursorPos (&hit.pt);
ScreenToClient (list,&hit.pt);
ListView_HitTest (list,&hit);
return (hit.iItem);
}
extern int far LV_GetCurSel (HWND list)
{
auto int count = ListView_GetItemCount (list);
auto UINT mask = LVIS_SELECTED;
auto UINT state;
auto int inx;
for (inx = NIL; inx < count; inx++) {
state = ListView_GetItemState (list,inx,mask);
if (state & mask)
return (inx);
}
return (-1);
}
extern int far LV_SetCurSel (HWND list,int index)
{
auto UINT mask = LVIS_SELECTED | LVIS_FOCUSED;
ListView_SetItemState (list,index,mask,mask);
ListView_EnsureVisible (list,index,FALSE);
return (index);
}
/* end of LV_Help.c - written by Gregory Braun */