?
Solved

View and Mouse with SCRIBBLE example

Posted on 1998-08-12
5
Medium Priority
?
461 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 120 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

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

801 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