Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting mouse move events in a derived CStatic control?

Posted on 1997-05-12
4
Medium Priority
?
762 Views
Last Modified: 2013-11-20
Hello people:

I am writing something that I want to look like the colour selector in the windows NT(95) control panel - you know the one, a button with a colour on, and when you click on it, a little dialog drops down, allowing you to select the colour you want.

I have the button working (Owner Draw CButton), but the dialog is giving some problems. By examining desk.cpl in NT, I see the dialog uses an owner-draw text (CStatic) control. Fine, I thought, I'll just do the same.

My problem is that I need to trap mouse-clicks and mouse-moves. Clicks don't seem to get through (unlike CButton controls), and neither CButton nor CStatic send through mousemoves. I need these to highlight the colour and to select the colour, in the same way they do it in Control Panel.

Spy++ shows that the control gets WM_NCIHITTEST messages, but trapping OnNcHittest() doesn't ever seem to get called.

Help! - Am I doing something wrong / do MS do something Mystic to get this to work? I *really* don't want to go through the hassle of creating a custom control for this...

// Nigel
0
Comment
Question by:magnayn
[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
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
mbhakta earned 140 total points
ID: 1301471
What is the ID of your static control. If it is IDC_STATIC (predefined = -1) then change it to some othe value IDC_XYZ = 3000 or something. The Static control should get WM_MOUSExxx messages like any other window.

Also, how are you attaching your control to the derived class ? I suggest using SubclassDlgItem().

If you still have trouble, reply back I might send you some sample.
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1301472
Yes, I want to trap mouse moves..I have found some example code that subclasses a CComboBox control, but I can't seem to apply it to anything more generic - I've tried making my colour control a CWnd, then subclassing that into the dialog control and it seems to half work.Example code would be appreciated..
0
 

Author Comment

by:magnayn
ID: 1301473
Please send your e-mail and I will mail you whatever samples I have.
0
 
LVL 4

Expert Comment

by:mbhakta
ID: 1301474
It's okay, I've solved it a different way. I created a
static, then moved a CWnd generated at runtime over the top
of it.

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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…

715 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