source: trunk/common_functions/listbox_funcs.c

Last change on this file was 4, checked in by stevenhl, 8 years ago

Import modifications from cwmm-0_2_9-work-01_10_2006.zip dated 2006-08-27

File size: 1.6 KB
Line 
1#define INCL_WIN
2#define INCL_PM
3
4#ifdef __EMX__
5#include <os2emx.h>
6#else
7#include <os2.h>
8#endif
9#include <stdlib.h>
10#include <string.h>
11
12#if __cplusplus
13extern "C" {
14#endif
15
16/*!***********************************************************/
17/* */
18/* @@DESC */
19/* */
20/* To be written... */
21/* */
22/*!!**********************************************************/
23SHORT LBFindMatch(HWND hwndLB, char *chrMatchText)
24{
25 SHORT sItem;
26 USHORT a;
27 ULONG ulMatchLen=strlen(chrMatchText);
28
29 if(ulMatchLen==0)
30 return (SHORT)LIT_NONE;
31
32 sItem=SHORT1FROMMR(WinSendMsg(hwndLB, LM_QUERYITEMCOUNT, 0L, 0L));
33 if(sItem==0)
34 return (SHORT)LIT_NONE;
35
36 for(a=0;a<sItem;a++)
37 {
38 SHORT sLength;
39 sLength=SHORT1FROMMR(WinSendMsg(hwndLB, LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(a), MPFROMLONG(0L)));
40
41 if(sLength==ulMatchLen) {
42 char *chrItemText;
43 /* Same length so compare */
44 if((chrItemText=malloc(sLength+1))==NULLHANDLE)
45 return LIT_NONE;
46 WinSendMsg(hwndLB, LM_QUERYITEMTEXT, MPFROM2SHORT(a, sLength+1), MPFROMP(chrItemText));
47 if(!strcmp(chrMatchText, chrItemText)) {
48 free(chrItemText);
49 return a;
50 }
51 free(chrItemText);
52 }
53 }
54 return (SHORT)LIT_NONE;
55}
56
57#if __cplusplus
58}
59#endif
Note: See TracBrowser for help on using the repository browser.