The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: DC on February 14, 2006, 03:12:14 AM

Title: getting text from a ComboBox Edit
Post by: DC on February 14, 2006, 03:12:14 AM
My ComboBox is with editable Edit, on OK I want to copy the text if it got changed... I get all the right signals in all the right places but can't copy the text?
this is all I can find to do and it doesn't work:
                    invoke  SendMessage, hCombo, CB_SETEDITSEL, 0, -1
                    invoke  OpenClipboard, hCombo
                    invoke  SendMessage, hCombo, WM_COPY , 0, 0
                    invoke  GetClipboardData, CF_TEXT
                    invoke  MessageBox,NULL,eax,eax,MB_DEFBUTTON1
                    invoke  CloseClipboard

any hope for me?
thanx,
DC
Title: Re: getting text from a ComboBox Edit
Post by: DC on February 14, 2006, 03:21:38 AM
I got it with this:
                    mov     ax, -1
                    shl     eax, 16
                    mov     ax, 0
                    invoke  SendMessage, hCombo, CB_SETEDITSEL, 0, eax
                    invoke  SendMessage, hCombo, WM_COPY , 0, 0
                    invoke  OpenClipboard, hCombo
                    invoke  GetClipboardData, CF_TEXT
                    invoke  MessageBox,NULL,eax,eax,MB_DEFBUTTON1
                    invoke  CloseClipboard

it seems like it should be more straight forward tho??
Title: Re: getting text from a ComboBox Edit
Post by: arafel on February 14, 2006, 03:38:59 AM
try

invoke  SendMessage, hCombo, WM_GETTEXT, sizeof somebuffer, ADDR somebuffer
invoke  MessageBox,NULL,ADDR somebuffer,0,MB_DEFBUTTON1
Title: Re: getting text from a ComboBox Edit
Post by: DC on February 14, 2006, 04:54:09 AM
thanx arafel,
sometimes it aint so straight forward, well that solution was, but knowing you could use WM_ messages instead of CB_ messages wasn't
later,
DC