e-Mail 

Password 

Signup Free!

Home
Search
Top Ten

Categories
Algorithms
API
Apple Mac
Audio
C#
Child Windows
Common Controls
Common Dialog Boxes
Controls
Data Storage
Design Patterns
File I/O
File Structure
GDI
Graphics
GUI
Hardware
Managed C++
MCI
Memory
Memory Management
Multimedia
Multiple-Document Interface
Multithreading
Networking
OOP
Resources
SDL
Search Algorithms
Text
Visual Studio
Visual Studio 2005
Windows
Windows Files
WinInet

Related Links
ASPToday
Code Project
Bear Cave
MSDN
Joel on Software
Keeping The Mouse Pointer Inside Client Area
Instruction on how to keep the mouse from moving outside client area

Article Stats
Skill Level 4
Expert - 10 4
Beginner - 1
Author: Khanh Nguyen
Date: 5/29/2003
Category: API
User Ratings:

Total Ratings: 1 
Innovative
Complete
Helpful
6/10
8/10
7/10


Abstract:
My term project is a simple chess game.  When the user drag a chess piece, 
that piece is suppose to move with the mouse as it is dragged and I have to 
report where the piece is dragged to.  If the user dragged it to somewhere 
outside of the client, then I’m lost.  One way to get the location outside of 
client is to “trap the mouse” using SetCapture().  Petzold has a good example 
on using SetCapture().  But there is no point on catching where the user 
dropped the piece outside of the client area since it’s not a valid move 
anyway.  The best way is to stop the user from dragging the piece outside of 
client area.  

Logon to read this entire article
Or sign up for an account FREE!