UnClickable window... Clicks thru
-
How do you create a window so when someone clicks on it the click event go to the window under it? (not the parent) thanks in advance
What do you mean by "the window under it"? Do you mean in the z-order, or perhaps the window that created the current window??? "the window under it" could be any window. Whichever window you mean, it's pretty easy to notify another window of an event in the current window. First add a WM_LBUTTONDOWN handler to both windows. (http://msdn.microsoft.com/en-us/library/ms645607(VS.85).aspx[^]) in the window class header files under DECLARE_MESSAGE_MAP()
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
in the window class source file for the window being clicked:
...
//pass the message on to another window...
void CMyWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
m_NotifyWnd.SendMessage(WM_LBUTTONDOWN);
}
...
//under BEGIN_MESSAGE_MAP
ON_WM_LBUTTONDOWN()
...where m_NotifyWnd is whatever window you want to notify of the click. Also remember to add the message map for the window receiving the notification. I did not preserve wparam and lparam across the SendMessage call, you will probably want to read up on the message (link above) and finish the code with the wparam and lparam arguments. Insofar as finding the correct window to notify, I direct you to the following CWnd member functions to check out (since I'm not quite sure what you're looking for): CWnd::GetParent[^] CWnd::GetOwner[^] CWnd::GetParentOwner[^] Additionally you can create a member of your class to store a pointer or reference to some other window to notify. Hope that helps :)
Chris Smith
-
How do you create a window so when someone clicks on it the click event go to the window under it? (not the parent) thanks in advance
Create a layared window. For more pls check SetLayeredWindowAttributes() in MSDN for how to create a layared window. Then set the Transparent property( WS_EX_TRANSPARENT ) for the dialog. Now the messages to the layared wnidow will be transferred to the window underlying it.
aks
-
Create a layared window. For more pls check SetLayeredWindowAttributes() in MSDN for how to create a layared window. Then set the Transparent property( WS_EX_TRANSPARENT ) for the dialog. Now the messages to the layared wnidow will be transferred to the window underlying it.
aks