home *** CD-ROM | disk | FTP | other *** search
- ' This somewhat inelegant and not very elaborate VB program
- ' demonstrates a number of SendMessage API commands which should
- ' help overcome the relatively limited set of properties/methods
- ' VB offers for simple list boxes. Some of the demos buttons use
- ' random numbers (e.g. to demonstrate finding listbox elements)
- ' to relieve you, the person playing with this, from having to
- ' type in bunches of search strings.
-
- ' There's no sample here for LB_DELETESTRING (I wouldn't want
- ' to ruin my list box contents now, would I?), but the code is:
-
- ' theList.SetFocus
- ' result& = SendMessage(GetFocus(), LB_DELETESTRING, ByVal itemIndex%, 0&)
-
- ' where itemIndex% is the index of the item to be removed.
-
- ' There are no samples for functions which can/should equally well
- ' be done using VB properties/methods, such as LB_GETCOUNT
- ' (= theList.ListCount).
-
- ' BTW: this demo marks the birth of JokeWare. If it's useful
- ' to you, I'd love to hear/read your favorite joke! Enjoy.
-
- ' Dave Th. Hutmacher [CIS 100012,74]
- ' Zurich, Switzerland
-
- '------------------------------------------------------------------
-
- DefInt A-Z
-
- Declare Function GetFocus% Lib "User" ()
- Declare Function SendMessage& Lib "USER" (ByVal hWnd%, ByVal wMsg%, ByVal wParm%, ByVal lparam As Any)
-
- Global Const WM_USER = &H400
-
- ' Listbox messages
- Global Const LB_ADDSTRING = (WM_USER + 1)
- Global Const LB_INSERTSTRING = (WM_USER + 2)
- Global Const LB_DELETESTRING = (WM_USER + 3)
- Global Const LB_RESETCONTENT = (WM_USER + 5)
- Global Const LB_SETSEL = (WM_USER + 6)
- Global Const LB_SETCURSEL = (WM_USER + 7)
- Global Const LB_GETSEL = (WM_USER + 8)
- Global Const LB_GETCURSEL = (WM_USER + 9)
- Global Const LB_GETTEXT = (WM_USER + 10)
- Global Const LB_GETTEXTLEN = (WM_USER + 11)
- Global Const LB_GETCOUNT = (WM_USER + 12)
- Global Const LB_SELECTSTRING = (WM_USER + 13)
- Global Const LB_DIR = (WM_USER + 14)
- Global Const LB_GETTOPINDEX = (WM_USER + 15)
- Global Const LB_FINDSTRING = (WM_USER + 16)
- Global Const LB_GETSELCOUNT = (WM_USER + 17)
- Global Const LB_GETSELITEMS = (WM_USER + 18)
- Global Const LB_SETTABSTOPS = (WM_USER + 19)
- Global Const LB_GETHORIZONTALEXTENT = (WM_USER + 20)
- Global Const LB_SETHORIZONTALEXTENT = (WM_USER + 21)
- Global Const LB_SETCOLUMNWIDTH = (WM_USER + 22)
- Global Const LB_SETTOPINDEX = (WM_USER + 24)
- Global Const LB_GETITEMRECT = (WM_USER + 25)
- Global Const LB_GETITEMDATA = (WM_USER + 26)
- Global Const LB_SETITEMDATA = (WM_USER + 27)
- Global Const LB_SELITEMRANGE = (WM_USER + 28)
- Global Const LB_MSGMAX = (WM_USER + 33)
- Global Const DM_GETDEFID = WM_USER + 0
- Global Const DM_SETDEFID = WM_USER + 1
-
- ' Listbox Return Values
- Global Const LB_OKAY = 0
- Global Const LB_ERR = (-1)
- Global Const LB_ERRSPACE = (-2)
-
-
-