سؤال

I want to change the default behaviour of a combobox (c++, win32 api). I make the combobox drop down when something is entered in its edit control I want to avoid the default behaviour that the combobox searches for the first match in the list, selects it, and enters the selected string into the edit control. Can I suppress this behaviour by catching the respective (LB_SETCURSEL etc.) messages out of the message queue myself with GetMessage()?

Does anyone habe a different idea of how to do it?

Greets Michbeck

هل كانت مفيدة؟

المحلول

You likely want to implement Window subclassing. This allows you to insert your own WndProc function into the combobox control that gets called before the control's own WndProc is called. You can filter out (and drop) window messages you don't want the control to get.

I'm not booted into my windows partition right now to run Spy++ on a combobox to see what messages it actually receives. My guess is that you want to filter out WM_CHAR from being received by the combobox.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top