Skip to Content
Programming Windows®, Fifth Edition
book

Programming Windows®, Fifth Edition

by Charles Petzold
November 1998
Intermediate to advanced
1520 pages
37h 53m
English
Microsoft Press
Content preview from Programming Windows®, Fifth Edition

Capturing the Mouse

A window procedure normally receives mouse messages only when the mouse cursor is positioned over the client or nonclient area of the window. A program might need to receive mouse messages when the mouse is outside the window. If so, the program can “capture” the mouse. Don’t worry: it won’t bite.

Blocking Out a Rectangle

To examine why capturing the mouse might be necessary, let’s look at the BLOKOUT1 program shown in Example 7-6. This program may seem functional, but it has a nasty flaw.

Example 7-6. The BLOKOUT1 program.

BLOKOUT1.C /*----------------------------------------- BLOKOUT1.C -- Mouse Button Demo Program (c) Charles Petzold, 1998 -----------------------------------------*/ #include <windows.h> LRESULT CALLBACK WndProc ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Windows®, Six Edition

Programming Windows®, Six Edition

Charles Petzold
Windows® via C/C++, 5th Edition

Windows® via C/C++, 5th Edition

Jeffrey Richter, Christophe Nasarre

Publisher Resources

ISBN: 9780735642225Purchase book