home *** CD-ROM | disk | FTP | other *** search
- Declare Function GetFocus Lib "user" () As Integer
- Declare Function SendMessage Lib "user" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wp As Integer, lp As Any) As Long
- Declare Function PutFocus Lib "user" Alias "SetFocus" (ByVal hWnd%) As Integer
-
- Const WM_USER = &H400
- Const LB_SETTABSTOPS = WM_USER + 19
-
- Sub Form_Click()
- Dim retVal&, R% 'API return values
- Dim hOldWnd%, lbhWnd% 'WinCtrl handles
- Static tabs(3) As Integer
-
- tabs(1) = 10 'Set up array of defined tab stops.
- tabs(2) = 70
- tabs(3) = 130
-
- hOldWnd% = GetFocus() 'Remember who had the focus.
- Form1.Show 'Showing the form avoids "Illegal
- ' Function Call" on 'List1.SetFocus'
- list1.SetFocus 'Set the focus to the list box.
- lbhWnd% = GetFocus() 'Get the handle to the list box.
-
- 'Send a message to the message queue.
- retVal& = SendMessage(lbhWnd%, LB_SETTABSTOPS, 3, tabs(1))
-
- R% = PutFocus(hOldWnd%) 'Restore handle to whoever had it.
-
- 'Place some elements into the list box, separated by TAB chars:
- list1.AddItem "Last Name" + Chr$(9) + "First Name" + Chr$(9) + "Year"
- list1.AddItem "Washington" + Chr$(9) + "George" + Chr$(9) + "1789"
- list1.AddItem "Adams" + Chr$(9) + "John" + Chr$(9) + "1797"
- list1.AddItem "Jefferson" + Chr$(9) + "Thomas" + Chr$(9) + "1801"
- list1.AddItem "Madison" + Chr$(9) + "James" + Chr$(9) + "1809"
- list1.AddItem "Monroe" + Chr$(9) + "James" + Chr$(9) + "1817"
- list1.AddItem "Adams" + Chr$(9) + "John Q." + Chr$(9) + "1825"
- End Sub
-
-