|
-
July 2nd, 2004, 05:27 AM
#1
Catching mouse event on window border
Hi all!
I'm wondering how to catch a certain mouse event:
After resizing a modeless dialog box, I want a function to run when the user releases the left mouse button. WM_LBUTTONUP won't work for some reason.
-
July 2nd, 2004, 05:30 AM
#2
Can you explain why WM_LBUTTONUP won't work ? Do you notice that you need to give a little bit more explanations to let us help you - if we can ?
-
July 2nd, 2004, 05:31 AM
#3
Look at the WM_NCLBUTTONUP message. It should work outside of the window, but I am not sure with the border.
-
July 2nd, 2004, 05:33 AM
#4
trap WM_NCLBUTTONUP message
-
July 2nd, 2004, 06:50 AM
#5
Seems WM_NCLBUTTONUP won't work either.
I'm running the program in a dialog window. From this dialog I can open modeless child dialogs. Each child dialog starts a thread to paint a Direct3D window inside the child dialog. When a child dialog is resized, I need to pause the thread, and when the user is finished resizing the dialog, the Direct3D device needs to be reset and the thread started again.
It would be easier of course if I could do without the thread, but I still need the dialog to be able to receive notifications and function calls, and I don't know how I would otherwise be able to do that.
-
July 2nd, 2004, 07:32 AM
#6
Originally Posted by O.P.
Seems WM_NCLBUTTONUP won't work either
well from ur problem it looks it shud work in ur scenario.
by the way have u tried it or not?
-
July 2nd, 2004, 08:16 AM
#7
Originally posted by Kapil Maheshwari
well from ur problem it looks it shud work in ur scenario.
by the way have u tried it or not?
ON_WM_LBUTTONUP does work somewhat, if I after I resized the dialog click once inside it. What I did then was to replace ON_WM_LBUTTONUP with ON_WM_NCLBUTTONUP in the MESSAGE_MAP structure and the OnLButtonUp(UINT, CPoint) with NcOnLButtonUp(...), but so far nothings happening.
Edit: I suppose there is a function for checking mouse stats, but I can't find anything. What function can I use to check the stats of mouse buttons?
Last edited by O.P.; July 2nd, 2004 at 08:47 AM.
-
July 2nd, 2004, 08:43 AM
#8
can u post ur project (may be dummy but simulating the same scenario).
-
July 4th, 2004, 07:01 AM
#9
Here's the relevant code. One weird thing tough: I get a response if I double click on the border.
Code:
BEGIN_MESSAGE_MAP(DialogSpectrum, CDialogView)
ON_BN_CLICKED(IDC_SUSPEND, OnBnClickedSuspend)
ON_BN_CLICKED(IDC_RUN, OnBnClickedRun)
// To get resize notification
ON_WM_SIZE()
ON_WM_NCLBUTTONUP()
END_MESSAGE_MAP()
void DialogSpectrum::OnNcLButtonUp(UINT u, CPoint c) {
RECT WindowRect;
if (Resizing && g_pd3dDevice) {
DisplayWnd.GetClientRect(&WindowRect);
d3dpp.BackBufferWidth = WindowRect.right;
d3dpp.BackBufferHeight = WindowRect.bottom;
g_pVB->Release();
g_pd3dDevice->Reset(&d3dpp);
g_pd3dDevice->CreateVertexBuffer(1024 * 3 * sizeof CUSTOMVERTEX,
0, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &g_pVB, NULL);
Resizing = false;
DialogThread->ResumeThread();
}
}
void DialogSpectrum::OnSize(UINT nType, int cx, int cy) {
if (DisplayWnd.GetSafeHwnd()) {
Resizing = true;
CDialog::OnSize(nType, cx, cy);
m_resizer.Move();
}
}
void DialogSpectrum::Paint(CArray<RadioUDP> &Arr, int PNum) {
[ ... ]
if (Resizing)
DialogThread->SuspendThread();
}
-
July 4th, 2004, 10:13 AM
#10
Why don't you handle WM_EXITSIZEMOVE and/or WM_ENTERSIZEMOVE?
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
July 5th, 2004, 06:12 AM
#11
Originally posted by JohnCz
Why don't you handle WM_EXITSIZEMOVE and/or WM_ENTERSIZEMOVE?
Good question. Now I do, and it worked just fine! Many thanks.
-
July 5th, 2004, 07:20 AM
#12
So, a question was a solution you needed. You are welcome, glad to be of help.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|