Solved

Getting mouse move events in a derived CStatic control?

Posted on 1997-05-12
4
751 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 70 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

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

630 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