Solved

View and Mouse with SCRIBBLE example

Posted on 1998-08-12
5
453 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
ID: 1320661
Edited text of question
0
 
LVL 3

Accepted Solution

by:
danny_pav earned 40 total points
ID: 1320662
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
ID: 1320663
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
ID: 1320664
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
ID: 1320665
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 84
List out all word 7 294
how to monitor remote shell execution on linux 9 100
withoutTen challenge 14 122
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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