Avatar billede uffe_kld Nybegynder
06. marts 2000 - 15:09 Der er 3 kommentarer og
1 løsning

ListView_FindItem

1) Er der nogen der kender en link, hvor man kan se brugen af ListView_FindItem eller en der har en eksempel at ligger.

2) Hvordan begrænser jeg søgningen med ListView_FindItem til en kolonne

Hilsen Uffe
Avatar billede nolle_k Nybegynder
08. marts 2000 - 10:14 #1
CListCtrl::FindItem
int FindItem( LVFINDINFO* pFindInfo, int nStart = -1 ) const;

Return Value

The index of the item if successful or -1 otherwise.




LVFINDINFO

typedef struct tagLVFINDINFO
{
    UINT flags;
    LPCTSTR psz;
    LPARAM lParam;
    POINT pt;
    UINT vkDirection;
} LVFINDINFO, FAR* LPFINDINFO;

Contains information used to search for a list view item. This structure is the same as the LV_FINDINFO structure but has been renamed to fit standard naming conventions.

flags
Type of search to perform. This can be one or more of the following values: LVFI_PARAM Searches based on the lParam member. The lParam member of the matching item's LVITEM structure must match the lParam member of this structure. If this value is specified, all other values are ignored.
LVFI_PARTIAL Checks to see if the item text begins with the string pointed to by the psz member. This value implies use of LVFI_STRING.
LVFI_STRING Searches based on the item text. Unless additional values are specified, the item text of the matching item must exactly match the string pointed to by the psz member.
LVFI_WRAP Continues the search at the beginning if no match is found.
LVFI_NEARESTXY Finds the item nearest to the position specified in the pt member, in the direction specified by the vkDirection member.

psz
Address of a null-terminated string to compare with the item text if flags specifies LVFI_STRING or LVFI_PARTIAL.
lParam
Value to compare with the lParam member of a list view item's LVITEM structure if the flags member specifies LVFI_PARAM.
pt
POINT structure that specifies the starting position to search from. This member is used only if LVFI_NEARESTXY is specified in the flags member.
vkDirection
Direction to search. This member contains the virtual key code of an arrow key that corresponds to the direction to search. This member is used only if LVFI_NEARESTXY is specified in the flags member.


Parameters

pFindInfo

A pointer to aLVFINDINFO structure containing information about the item to be searched for.

nStart

Index of the item to begin the search with, or -1 to start from the beginning. The item at nStart is excluded from the search if nStart is not equal to -1.

Remarks

Use this function to search for a list view item having specified characteristics.

The pFindInfo parameter points to an LVFINDINFO structure, which contains information used to search for a list view item.


Jeg vil godt kigge på det hvis ikke dette hjælper!!

//Nolle_K
Avatar billede nolle_k Nybegynder
08. marts 2000 - 10:15 #2
Her kommer første del igen!!

int FindItem( LVFINDINFO* pFindInfo, int nStart = -1 ) const;

Return Value

The index of the item if successful or -1 otherwise.

Parameters

pFindInfo

A pointer to aLVFINDINFO structure containing information about the item to be searched for.

nStart

Index of the item to begin the search with, or -1 to start from the beginning. The item at nStart is excluded from the search if nStart is not equal to -1.

Remarks

Use this function to search for a list view item having specified characteristics.

The pFindInfo parameter points to an LVFINDINFO structure, which contains information used to search for a list view item.


//Nolle_K
Avatar billede uffe_kld Nybegynder
08. marts 2000 - 11:41 #3
Jeg tror har fundet løsningen, mit problem var at den hele tiden returnerede -1, det skyldes at Listview_FindItem hænger sammen med LVN_ODFINDITEM og den var sat til returner -1. (den del af koden havde jeg taget fra et eksempel). Men det bliver nødvendig at lave min egen søge rutine da den også skal kunne søge på subitems.
Avatar billede nolle_k Nybegynder
08. marts 2000 - 11:45 #4
I orden du!!!
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester