Can somebody please tell me why the following code fails?
If it is relevant, my O.S. is Windows ME.
width=400 ; Window client width
height=300 ; Window client height
gap=20 ; Gap between gadgets
hwin=CreateWindow("Testing",100,50,width,height,0,33)
lbox=CreateListBox(gap,gap,width-gap*2,height-gap*2,hwin)
If lbox=0 Then Notify "Didn't create listbox": End
AddGadgetItem lbox,"Line 1"
AddGadgetItem lbox,"Line 2"
items=SendMessage(lbox, $18B, 0, 0) ; LB_GETCOUNT
; Next line should add "2" to the listbox, but adds "0"
AddGadgetItem lbox,Str$(items)
Repeat
Select WaitEvent()
Case $803: Exit ; Window close
End Select
Forever
It creates a listbox, populates it with 2 lines of text and then uses the SendMessage() API call to count the number of lines (2) and then display the count as a further line in the listbox. But 0 is displayed, not 2 as I expect. Why?
My userlibs folder contains a single .decls file containing the following lines (amongst other lines):
.lib "user32"
SendMessage%(hwnd%, wMsg%, wParam%, lParam%):"SendMessageA"
Also, a further question:
How do I create a listbox with style LBS_MULTICOLUMN so that I can send it the message LB_SETCOLUMNWIDTH ?
Anthony Jordan
If it is relevant, my O.S. is Windows ME.
width=400 ; Window client width
height=300 ; Window client height
gap=20 ; Gap between gadgets
hwin=CreateWindow("Testing",100,50,width,height,0,33)
lbox=CreateListBox(gap,gap,width-gap*2,height-gap*2,hwin)
If lbox=0 Then Notify "Didn't create listbox": End
AddGadgetItem lbox,"Line 1"
AddGadgetItem lbox,"Line 2"
items=SendMessage(lbox, $18B, 0, 0) ; LB_GETCOUNT
; Next line should add "2" to the listbox, but adds "0"
AddGadgetItem lbox,Str$(items)
Repeat
Select WaitEvent()
Case $803: Exit ; Window close
End Select
Forever
It creates a listbox, populates it with 2 lines of text and then uses the SendMessage() API call to count the number of lines (2) and then display the count as a further line in the listbox. But 0 is displayed, not 2 as I expect. Why?
My userlibs folder contains a single .decls file containing the following lines (amongst other lines):
.lib "user32"
SendMessage%(hwnd%, wMsg%, wParam%, lParam%):"SendMessageA"
Also, a further question:
How do I create a listbox with style LBS_MULTICOLUMN so that I can send it the message LB_SETCOLUMNWIDTH ?
Anthony Jordan