function.
sent out the serial port.
Repeated at a rate of once per second or a variable time.
When you release the button it stops.
I have looked at a repeatbutton class but dont quite understand it.
Thanks.
Displaying a message box is a bit more involved than simply changing the
text of a button. Actually since you want to change the text of a
messagebox then you can't really use a messagebox, you will have to use a
modeless dialog.
If you were to simply change the text of a control on your dialog, then
first you catch the WM_LBUTTONDOWN message
void CMyAppDlg::OnLButtonDown(....)
{
c_ButtonStatus.SetWindowText(_T("L Button Dn"));
}
then you catch the WM_LBUTTONUP message
void CMyAppDlg::OnLButtonUp(...)
{
c_ButtonStatus.SetWindowText(_T("L Button Up"));
}
Now if you want to do the modeless dialog then in the OnLButtonDown, you
would create/show the modeless dialog, and then in the OnLButtonUp you
would change the text in the dialog. With that said, I'm not exactly
sure you would get the OnLButtonUp message if you were to popup another
dialog in your OnLButtonDown, I would have to write a sample to test
this, but I'm pretty sure that it would go to the new dialog.
With the first case, keep in mind that if you do this and the user clicks
in your window and then moves the mouse outside of your window, and then
releases the mouse you will not get the up message, unless you capture
the mouse.
void CMyAppDlg::OnLButtonDown(....)
{
SetCapture();
c_ButtonStatus.SetWindowText(_T("L Button Dn"));
}
void CMyAppDlg::OnLButtonUp(...)
{
ReleaseCapture();
c_ButtonStatus.SetWindowText(_T("L Button Up"));
}
AliR.
"Eddards" <eddards@verizon.net> wrote in message
news:MvSdnW1uRZZ2qTzXnZ2dnUVZ_qudnZ2d@giganews.com...
How do I change the code below to display message that the left mouse
button is down and update the message when released?
void CMyAppDlg::OnTest()
{
//if left button is held down
c_ButtonStatus.SetWindowText("L Button Dn"); //display's message when
LButton is clicked.
//if left button is released
// c_ButtonStatus.SetWindowText("L Button Up"); //display's message
when LButton is released.
}