I am having a hard time finding a way to make a simple loop which will add items to a ListBox. Can anyone help me out here by pointing me in the right direction? Even vague code examples would be useful at this point, hehe...
It might help to let you know that I am coming from Delphi and am very new at working with MASM.
Delphi Example:
procedure TForm1.Button1Click(Sender: TObject);
var
X: Integer;
begin
X := 100;
while X > 0 do
begin
dec(X);
ListBox1.Items.Add('Just a string.');
end;
Can I do something similar to the above? Or is it much more complicated?
Any help is very much appreciated. Also, sorry if this question has been answered a thousand times. I searched the forum and didn't find any answer to this question (yes, it's possible I missed it).
Thank you.
Yes, you can do something very similar. Send the message LB_ADDSTRING to the listbox to add strings.
e.g.
invoke SendMessage,HandleOfYourListbox,LB_ADDSTRING,0,ADDR StringContainingText
MCD
This is just an ampliification of Jim's help just in case you do not know how a while loop is coded in assembly.
.data?
X dd ?
.code
; Some code here
mov X, 100
.while X != 0
sub X, 1
invoke SendMessage,HandleOfYourListbox,LB_ADDSTRING,0,ADDR StringContainingText
.endw
; The rest of the story...
Paul
Thank you both for your help.
@PBrennick:
The code example was great, thank you. I had not known how to do the while loop and am actually surprised by how close to the Delphi example it is.
Thank you again.