Solved

Class derived from CScrollBar does not recieve ON_WM_CTLCOLOR!

Posted on 2008-10-14
3
646 Views
Last Modified: 2013-11-20
Ah hello.

I have derived a class from CScrollBar, CMyScroll.  I add a V scrollbar and H scrollbar to my dialog, then link them up via DDX so they are instances of CMyScroll. In the CMyScroll class I handle the OnCtlColor message, in the hope of painting the scrollbar a different colour internally, as opposed to having to have OnCtlColor in the parent dialog

However, this message never gets sent, so my OnCtlColor function never gets called.

I can stick a breakpoint on CMyScroll::PreTranslateMessage, and this gets hit, but not OnCtlColor.

Why is this?

TIA
0
Comment
Question by:mrwad99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 100 total points
ID: 22711543
Hi mrwad99,

this message is sent to the parent window of the control, not to the control itself. It should work with message reflection using the macro ON_WM_CTLCOLOR_REFLECT.

Hope that helps,

ZOPPO
0
 
LVL 19

Assisted Solution

by:alb66
alb66 earned 25 total points
ID: 22711625
Zoppo is right. Here you can find an explanation on how reflection works:
http://msdn.microsoft.com/en-us/library/eeah46xd(VS.71).aspx
0
 
LVL 19

Author Comment

by:mrwad99
ID: 22711692
Thank you ZOPPO, that now works.

Thanks alb66; I keep meaning to read that link...perhaps if I would have read it earlier I would not have asked this question :o)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Pressing cancel button with C# UI Automation 3 92
maven archtype selection in eclipse 1 58
zeroFront challenge 7 124
How to convert MFC::CString to UTF8 wchar_t* 10 387
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question