Solved

Class derived from CScrollBar does not recieve ON_WM_CTLCOLOR!

Posted on 2008-10-14
3
609 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 157
Generic progress indicator 6 113
countEvens challenge 2 78
sum28 challenge 31 106
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

896 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now