have a look at the sample at the following link
http://www.funducode.com/f
Main Topics
Browse All TopicsHi, could anyone provide me some sample codes on how to do a seperate control for onbuttoup and for onbuttondown please?
I know OnLButtonDown and OnLButtonUp is needed , but i do not know how to use it. Could anyone teach me how to do it please?
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
have a look at the sample at the following link
http://www.funducode.com/f
As OnegaZhang points out you need WM_LBUTTONDOWN and WM_LBUTTONUP messages.
You can use the class wizard to add messages to the message map, or you can add them manually. Right click the class in the project tree to use wizard. The messagemap entries for button up/down look like this in my CMapView class (a CView descendant)
BEGIN_MESSAGE_MAP(CMapView
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
END_MESSAGE_MAP()
Your class member function looks like this
afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
afx_msg void OnLButtonUp( UINT nFlags, CPoint point );
The "nFlags" are typically used to identify if control of shift is down. The "point" is the mouse position when clicked. Press F1 in the source window with the cursor on the "ON_WM_LBUTTONDOWN()", and you will find the info you need.
Good luck
Ruskialt
Hi,
If you wnat to implement onbuttonup and onbuttondown to be implemented on a Cbutton.
Derive a class from CButton and handle these messages (onbuttonup and onbuttondown )there and create the Button object with the derive class. If you don't want to derive it then override WindowProc and when WM_LBUTTONDOWN() WM_LBUTTONUP() are encountered then check the window handle with the button handle, if they equal then user has clicken on the button.
-Surya
Business Accounts
Answer for Membership
by: OnegaZhangPosted on 2004-10-24 at 21:18:05ID: 12397244
add two message handlers WM_LBUTTONDOWN and WM_LBUTTONUP
when left mouse button is down, OnLButtonDown is being called.