Hello,
i know this is a noob question, but i haven't any idea how to change
the backgroundcolor for a trackbar, so i try a question here.
I have the following code snippets inside a DLL,
the problem is this XXXX in the subclass, it do nothing,
i have try FillRect with a solidbrush or other things, no luck :(

any ideas? whats wrong?

===========================================
WNDPROC oldSliderWindowProc;

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
lParam)
{
case WM_CREATE:
{
...
hwndSlider = CreateWindow(TRACKBAR_CLASS,"",WS_CHILD | WS_VISIBLE |
TBS_NOTICKS,1,1,120,20,hwnd,(HMENU)0,
(HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
SendMessage(hwndSlider, TBM_SETRANGE, FALSE, MAKELONG(SLIDER_MIN,
SLIDER_MAX/SLIDER_DIV));
SendMessage(hwndSlider, TBM_SETPOS, TRUE,
DBGetContactSettingDword(NULL,SERVICENAME,"Volume",1000)/SLIDER_DIV);
oldSliderWindowProc = (WNDPROC)SetWindowLong(hwndSlider, GWL_WNDPROC,
(LONG)SubclassedSliderWindowProc);
...
}
}
LRESULT CALLBACK SubclassedSliderWindowProc(HWND hwnd, UINT msg, WPARAM
wParam, LPARAM lParam)
{
switch(msg)
{
case WM_ERASEBKGND:
XXX
return TRUE;
}
return CallWindowProc(oldSliderWindowProc, hwnd, msg, wParam, lParam);
}

--
Newsreader: http://mesnews.net/index-gb.php
Deutsche Hilfedatei: http://www.lastwebpage.de/download/mesnews-de.zip

Re: How to set a backgroundcolor for a windows control (Trackbar) ? by Jeff

Jeff
Sat Jul 23 08:38:47 CDT 2005

You'll have to double-check what works for a trackbar using XP Themes, but
for a non-themed trackbar, I think you can handle the WM_CTLCOLORSTATIC
message to change the control's background by returning an HBRUSH of the
desired color. For the thumb, I think you'll need to handle NM_CUSTOMDRAW.
--
Jeff Partch [VC++ MVP]



Re: How to set a backgroundcolor for a windows control (Trackbar) ? by Peter

Peter
Sat Jul 23 09:40:04 CDT 2005

Jeff Partch [MVP] schrieb :
> You'll have to double-check what works for a trackbar using XP Themes, but
> for a non-themed trackbar, I think you can handle the WM_CTLCOLORSTATIC
> message to change the control's background by returning an HBRUSH of the
> desired color. For the thumb, I think you'll need to handle NM_CUSTOMDRAW.

I get no WM_CTLCOLORSTATIC or other WM_CTL messages for this subbclass
control, i think i must use my own control class /Customdraw :(

Peter

--
Newsreader: http://mesnews.net/index-gb.php
Deutsche Hilfedatei: http://www.lastwebpage.de/download/mesnews-de.zip



Re: How to set a backgroundcolor for a windows control (Trackbar) ? by Jeff

Jeff
Sat Jul 23 18:01:19 CDT 2005

"Peter Flindt" <public@lastwebpage.de> wrote in message
news:mn.bbe87d574dc21174.28155@lastwebpage.de...
> Jeff Partch [MVP] schrieb :
> > for a non-themed trackbar, I think you can handle the WM_CTLCOLORSTATIC
> > message to change the control's background by returning an HBRUSH of the
> > desired color.
>
> I get no WM_CTLCOLORSTATIC or other WM_CTL messages for this subbclass
> control
>

Peter, Just for the record: I do get the WM_CTLCOLORSTATIC.
--
Jeff Partch [VC++ MVP]




Re: How to set a backgroundcolor for a windows control (Trackbar) ? by Peter

Peter
Sun Jul 24 06:24:54 CDT 2005

Jeff Partch [MVP] schrieb :
> ...
> Peter, Just for the record: I do get the WM_CTLCOLORSTATIC.
Sorry my mistake i search in the subclass...

Peter


--
Newsreader: http://mesnews.net/index-gb.php
Deutsche Hilfedatei: http://www.lastwebpage.de/download/mesnews-de.zip