The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: remus2k on February 08, 2008, 06:07:12 PM

Title: combobox getext
Post by: remus2k on February 08, 2008, 06:07:12 PM
hello

i have a problem i cannot get the text from a combobox

invoke SendMessage,hCombo,CB_GETCURSEL,0,0
invoke SendMessage,hCombo,CB_GETLBTEXT,eax,addr hbuffer
invoke MessageBox,hWnd,addr hbuffer,0,MB_OK

can your help me please

thanks
Title: Re: combobox getext
Post by: ToutEnMasm on February 08, 2008, 07:16:58 PM
Hello,
Verify the value of eax
Quote
The return value is the length of the string, in bytes, excluding the terminating null character.
If the index parameter does not specify a valid index, the return value is CB_ERR
The title of the messagebox couldn't be null (error in title)
put the index in edx,not eax
Quote
mov edx,eax
.if edx != CB_ERR
    .if edx != 0   ;NULL chain
         invoke MessageBox,hWnd,addr hbuffer,SADR("Title"),MB_OK
    .else
         invoke MessageBox,hWnd,SADR("Empty String"),SADR("Title"),MB_OK
    .endif
.endif