I'm new to asm, when I try to add a string to the listbox, it doesn't work, even if I use addr, like

invoke SendMessage,listbox,LB_ADDSTRING,0,addr string

There are no errors when I don't use addr, but it doesn't put the string in the listbox, but when I do use addr I get a message that says invalid value
Posted on 2002-08-17 14:15:38 by CyberGuy
This is Masm syntax, Fasm syntax is to use ptr instead or addr, like

invoke SendMessage,listbox,LB_ADDSTRING,0,ptr string
invoke SendMessage,listbox,LB_ADDSTRING,0,

but then again, I'm new to Fasm, so that might also be totally out of the way...
Posted on 2002-08-17 14:39:29 by Natix
Neither methods worked, ptr returned an invalid value error, and returned a invalid size of operand error
Posted on 2002-08-17 14:47:57 by CyberGuy

I think it's complaining about listbox :o

can you post some other code too? might help :)
Posted on 2002-08-17 14:58:16 by Natix
Is listbox a variable containing handle? Then it should be:

invoke SendMessage,[listbox],LB_ADDSTRING,0,string
Posted on 2002-08-17 15:29:26 by Tomasz Grysztar
"invoke SendMessage,,LB_ADDSTRING,0,string" returns no errors, but it doesn't add the string to the listbox, and listbox does contain a handle. In C++ you have to use (LPARAM)string to convert the string, but how do you do that in FASM?
Posted on 2002-08-17 18:12:49 by CyberGuy
what is string? how is it define?
t1 DB "Test", 0

invoke SendMessage, [listbox], LB_ADDSTRING, NULL, t1
try this for testing purposes, if this works then the string "variable" you originally declared doesn't contain a string but a number.
Posted on 2002-08-17 18:19:20 by stryker
it didn't work, there were no errors but it didn't put the string in the listbox, I seem to need to convert the string into a specific format. Does anyone know how?
Posted on 2002-08-17 18:44:52 by CyberGuy
really? are you sure is really the handle to the listbox? Try this sample.
Posted on 2002-08-17 19:33:28 by stryker
thanks alot, I just made a really careless mistake that caused the whole thing not to work
Posted on 2002-08-22 16:58:26 by CyberGuy