How can I identify which of two subclassed controls the mouse is over?

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

How can I identify which of two subclassed controls the mouse is over?

I have a dialog app with two separate static controls. Both controls have been subclassed from CStatic derived class to implement drag and drop and double clicking. The class works just fine, but I cannot figure out which of the controls is being double clicked or dragged and dropped onto because I only have the code below operating. I need some method in the derived class to determine which control is being manipulated.

Re: How can I identify which of two subclassed controls the mouse is over?

Originally Posted by Mike Pliam

I need some method in the derived class to determine which control is being manipulated.

You're welcome to tell me how stupid I am and that I should know better. That's OK. But please help. Thanks : )

The whole point about message reflection is to notify the particular object about being manipulated to let the one do all required processing on its own. If under the circumstances your control needs to identify itself, afraid that's something wrong with the design of objects relationship. Anyway, as Victor suggested, this self identification can be done based on the control's ID. See the sample for that.

Re: How can I identify which of two subclassed controls the mouse is over?

Originally Posted by Mike Pliam

I need some method in the derived class to determine which control is being manipulated.

Then why not put a method in there? C++ supports multiple inheritance, so why not create a base class with a pure virtual method? Then you can call the method no matter which control it is and get the necessary response.

Admittedly, this is somewhat an abuse of the class system, especially since there's only 2 controls, but I just wanted to point out that it's a possibility (especially if you add more controls).