Solved

View and Mouse with SCRIBBLE example

Posted on 1998-08-12
5
457 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

726 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