Solved

View and Mouse with SCRIBBLE example

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

Industry Leaders: 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

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 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