Solved

View and Mouse with SCRIBBLE example

Posted on 1998-08-12
5
449 Views
Last Modified: 2013-11-20
This question is about WM_LBUTTONDOWN with regards to client area. Discussion will include examples from Scribble, step6.

Definitions in VC++
client area:
The part of a window where the application displays output such as text or graphics.
WM_LBUTTONDOWN:
The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
CWnd::OnLButtonDown:
afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
Note   This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.
In scribble, I can move the mouse outside of the view as well as outside the application window, and still capture the mouse position. Why does this happen? Can I capture the mouse only when it is in my view? WM_LBUTTONDOWN states that I should only be capturing it in my client area. I believe my client area is only my view.
0
Comment
Question by:Paullkha
  • 3
  • 2
5 Comments
 
LVL 2

Author Comment

by:Paullkha
Comment Utility
Edited text of question
0
 
LVL 3

Accepted Solution

by:
danny_pav earned 40 total points
Comment Utility
You can capture the mouse at any location. The OnLButtonDown will be sent to your window only when the mouse is over it.
0
 
LVL 2

Author Comment

by:Paullkha
Comment Utility
How would I set up my view so that I ignore the mouse when it is outside of my view?
ClassWizard overrode OnLButtonDown function. It overrode the message WM_LBUTTONDOWN. My client area is not the entire screen, I hope.
0
 
LVL 3

Expert Comment

by:danny_pav
Comment Utility
I looked at the scribble years and years ago.  But from memory, I am guessing that:
1. on LBtnDown, the mouse is being captured
2. On LBtnUp, the mouse is being released

According to windows docs:
The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

So, you should not be getting OnLButtonDown when the mouse is not over the view.  However, you will still get onMouseMove's because you capture the mouse.

0
 
LVL 2

Author Comment

by:Paullkha
Comment Utility
I believe I was getting the message confused. Thanks!. I use known examples for problems I have because its easier than posting your own (or your companies) source-code. ;)
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now