i superclass "EDIT" window...everything works except i cant modify background color and i really need that!i change cursor etc and it worx, except the .hbrBackground = (HBRUSH)GetStockObject(BLAC_BRUSH);......please help, also if exist any function in wm_paint that could color this would help but i didnt found it, except for setting color for text and textbackground..but i want to change whole background, thank you! This message was edited by Hiroshimator, on 3/20/2001 2:22:22 PM
Posted on 2001-03-20 13:04:00 by Geecko
Geeko, The WM_PAINT message doesn' paint the background, WM_ERASEBKGND does, cach that, and paint you background there. Umbongo
Posted on 2001-03-20 14:04:00 by umbongo
but with what function, and why doesnt superclassing workx anyway? 10x for answer
Posted on 2001-03-20 14:36:00 by Geecko
As I just learned the other day, the WM_CTLCOLORSTATIC message is sent as a control is preparing to draw it's background. Intercept this message and you can change the color to that of your choice. In my case, I had a dialog window with a read-only edit control, which unalterably defaults to a gray background. So I stuck the following message handler in the dialog proc to change this:

    .ELSEIF uMsg == WM_CTLCOLORSTATIC
        invoke GetDlgItem,hWnd,IDC_EDIT
        .IF eax == lParam
            invoke GetStockObject, WHITE_BRUSH
            ret
        .ELSE
            mov eax, 1
            ret
        .ENDIF
Note we retuern the brush handle to change the color, or else return "1" to indicate we did NOT handle this message, as other controls would need this default processing. ------------------------------- "Son, when you participate in sporting events, itís not whether you win or lose: itís how drunk you get."
Posted on 2001-03-20 22:18:00 by Ernie
Ernie: a read-only edit control acts like a static control: that's why Windows sends WM_CTLCOLORSTATIC message to the control when it needs to repaint the control. However, for normal edit control, you must intercept WM_CTLCOLOREDIT message instead.
Posted on 2001-03-20 23:05:00 by Iczelion
Very thank you for reply, but i am wondering anyway why superclassing doesnt work. i superclass hrbBackground appropriate and it just doesnt go...if i change wndproc, cursor it works very well, bye
Posted on 2001-03-21 03:27:00 by Geecko