Solved

Getting mouse move events in a derived CStatic control?

Posted on 1997-05-12
4
701 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
  • 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 21
Doc'in system (example?) BA 7 78
has77  challenge 9 67
sumHeights  challenge 17 60
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 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

13 Experts available now in Live!

Get 1:1 Help Now