Click here to Skip to main content
16,022,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my application I have a window for which I catch the ON_WM_LBUTTONDOWN message in the function OnLButtonDown( UINT, CPoint). In that window I create a CStatic control. Clicking on that control quiet well brings me into the function OnLButtonDown(). But if I create a window (with CreateWindow() function ) in the static control I am unable to catch the mouse click. Is there any ideas? thanks for help!



Nalek said, that the the new window catches the click. I understand. But he maybe didn't understand the problem well. when I click on empty static control the click is reached to parent one. But if the static control is not empty (i.e. there is another window created) the click is not handled by the parent window.
Posted
Updated 28-Jan-10 22:24pm

1 solution

Because the click will be catched in the new window.

If you want it in the previous one, you should notify it back.

Addition 1:
I think it was more on the opposite way ;)

If you click in a static control (for example on a label), is the parent the one that handles the click, so OnLButtonDown will be triggered.

From msdn[^]

[quote]
A static control normally takes no input and provides no output; however, it can notify its parent of mouse clicks if it's created with SS_NOTIFY style.
[/quote]

But if you use CreateWindow (...), it depends a lot on which kind of CWnd derived are you creating, that the previous behaviour stays or not.
For instance. A button is CWnd derived class, if you create a button but don't implement the OnButtonClick it may happens that the parent doesn't execute the OnLButtonDown.

Take a look to CreateWindow ()[^]

Endly, if you provide a bit more info about what are you creating and some relevant code snippets, you will probably get a better / more concrete answer to your problem.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900