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.
Printable View
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.
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 ?
Look at the WM_NCLBUTTONUP message. It should work outside of the window, but I am not sure with the border.
trap WM_NCLBUTTONUP message
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.
well from ur problem it looks it shud work in ur scenario.Quote:
Originally Posted by O.P.
Seems WM_NCLBUTTONUP won't work either
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.Quote:
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?
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?
can u post ur project (may be dummy but simulating the same scenario).
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();
}
Why don't you handle WM_EXITSIZEMOVE and/or WM_ENTERSIZEMOVE?
Good question. Now I do, and it worked just fine! Many thanks.Quote:
Originally posted by JohnCz
Why don't you handle WM_EXITSIZEMOVE and/or WM_ENTERSIZEMOVE?
So, a question was a solution you needed. You are welcome, glad to be of help.