winapi - Setting the text and background colours of a super classed listbox control -


i in process of writing super classed version of windows listbox common-control add functionality.

a standard control sends wm_ctlcolorlistbox message parent allows both text , background colours specified @ run time within appropriate message handler. wm_ctlcolorlistbox not sent control itself, therefore cannot encapsulated , handled internally.

the scenario attempting address change background , text colours depending on control's enabled/disabled state. standard behaviour of leaving listbox background same shade regardless of state looks ugly , inconsistent me. there way set these values within encapsulation, yet hand-off other painting tasks base-class window procedure?

i wondered using setclasslongptr(). however, not not address text colour if understand rightly change background controls of class in existence , not specific control state has changed.

the answer should obvious - since wm_ctlcolorlistbox sent parent window, have subclass parent window in order receive message. there no getting around that. however, wrapper ui frameworks, vcl, designed forward such messages control generated then, controls can handle own messages. if not using wrapper framework , working win32 directly, have handle parent messages yourself. refer msdn details subclassing given hwnd:

subclassing controls


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -