home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / lb_msgs / lb_msgs.glo < prev    next >
Text File  |  1992-09-01  |  3KB  |  73 lines

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