Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Class derived from CScrollBar does not recieve ON_WM_CTLCOLOR!

Posted on 2008-10-14
3
Medium Priority
?
682 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 400 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 100 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

636 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