Advanced MFC Programming: Supporting Document
Advanced MFC Programming: Supporting Document
Supporting Document
Table of Contents
Summary:
CHAPTER 2. MENU
ii
Checking a Menu Item
Summary
Summary
iii
CHAPTER 4. BUTTONS
4.3 Subclass
Implementing Subclass
Bitmap Button
Summary
5.5 Slider
Including Slider Control in the Application
Handling Slider Related Messages
iv
Trapping Double Clicking Message
Retrieving the Contents of an Item
Message WM_DESTROY
5.14 Drag-n-Drop
Handling New Messages
New Member Variables and Functions
Node Copy
TVN_BEGINDRAG
WM_MOUSEMOVE
WM_LBUTTONUP
v
Using Animate Control and Progress Control
Timer
Custom Resource
Sample Implementation
Summary:
6.4 Sizes
Initial Size
Dialog Box Unit
Tracking Size and Maximized Size
Sample
Summary:
vi
CHAPTER 7. COMMON DIALOG BOXES
Summary:
vii
CHAPTER 8. DC, PEN, BRUSH AND PALETTE
8.1 Line
Creating Pen
Drawing Mode
Storing Data
Recording One Line
8.3 Curve
Summary:
CHAPTER 9. FONT
viii
9.1 Outputting Text Using Different Fonts
9.7 One Line Text Editor, Step 4: Caret Moving & Cursor Shape
New Functions
Moving Caret Using Keyboard
Moving Caret Using Mouse
Cursor Shape
Handling WM_LBUTTONDOWN to Move Caret
9.9 One Line Text Editor, Step 6: Cut, Copy and Paste
Global Memory
Clipboard Funcitons
Deleting Selected Text
Message Handlers for Cut, Copy Paste Commands
Summary:
ix
Retrieving the Dimension of Bitmap Image
Sample 10.1\GDI
Sample 10.1-2\GDI
x
Summary
11.0 Preparation
11.4 Tracker
Implementing Tracker
Moving and Resizing Tracker
Customizing Cursor Shape
New Tool
If Mouse Clicking Doesn’t Hit the Tracker
If Mouse Clicking Hits the Tracker
11.6 Region
Basics
Region Creation
Using Region
Sample
11.7 Path
Basics
Path & Region
Sample 11.7-1\GDI
Obtaining Path
Sample 11.7-2\GDI
xi
11.9 Cut, Copy and Paste
Clipboard DIB Format
Preparing DIB Data
Cut & Copy
Paste
Summary
Summary
xii
Sample 13.1\Once
13.9 Z-Order
13.10 Hook
Hook Installation
System Wide Hook
Variables in DLL
Defining Data Segment
DLL Implementation
Sample 13.6\Hook
xiii
Playing back the Recorded Events
Using Functions Contained in DLL
Summary
xiv
14.9 Simple Explorer, Step 7: File Sort
Sort Related Functions
Adding Parameters to Items
Functions Implementing Comparisons
Using Parameter to Find an Item
Comparing Two Items by File Names
Notification LVN_COLUMNCLICK
Summary
xv
Samples
Summary
Summary
INDEX
xvi
Appendix A. Virtual-key Codes
Index
Index
# BEGIN_MESSAGE_MAP, 7
Bezier curve, 344
#if, 402 BIF_BROWSEFORCOMPUTER, 171
#pragma, 401 BIF_BROWSEFORPRINTER, 171
.cnt, 465 BIF_RETURNFSANCESTORS, 172
.hm, 468 BIF_RETURNONLYFSDIRS, 172
.hpj, 465 Binary bitmap image, 313
__declspec, 402 Bit count per pixel, 276
_AfxCommDlgProc, 188 BITMAP, 50, 195, 273, 285
_chdir, 101 Mask bitmap, 77
_chdrive, 423 Obtain handle, 72
_getdrive, 423 Transparent background, 76
16 color, 215 Bitmap resource
16 color DIB, 276, 282 Add, 44
24 bit, 215 Bitmap size, 51
24-bit DIB, 276, 282 Bitmap with transparancy, 309
24-bit to 256-color format conversion, 297 BITMAPFILEHEADER, 282
256 color, 215 BITMAPINFO, 276, 305
256 color DIB, 276, 282 BITMAPINFORHEADER, 276
256-color to 24-bit conversion, 293 Black-and-white image, 302
8.3 format, 168 BN_CLICKED, 131
-SECTION, 403 BROWSEINFO, 171, 172
-SEGMENT, 401 Brush, 64, 65, 195
Hatched, 64
Hollow brush, 202
A Solid, 64
Button
AFX_IDS_APP_TITLE, 390 Bitmap check box and radio button, 70, 74
AFX_IDW_CNTROLBAR_FIRST, 157 Button states, 68
AFX_IDW_CONTROLBAR_LAST, 157 Irregular shape bitmap button, 76
AFX_IDW_PANE_FIRST, 57 Mouse sensitive button, 87
AfxCore.rtf, 465 Owner-draw bitmap button, 68
AfxGetApp, 27 Trap WM_LBUTTONUP message, 84
AfxGetInstanceHandle, 173, 181
AfxGetMainWnd, 43, 193
AfxGetResourceHandle, 154, 278 C
AfxRegisterClass, 380
AND, 304, 314, 339 Callback function, 233
Animate control, 134–36 CallNextHookEx, 403
APPCLASS_STANDARD, 442 CAnimateCtrl, 134
APPCMD_CLIENTONLY, 442 CAnimateCtrl::Open, 134
APPCMD_FILTERINITS, 442 CAnimateCtrl::Play, 134
ARROW key, 252 CAPS LOCK key, 252
Attach menu, 53 Caption bar, 388
Auto tick, 96 Caption text, 389
AVI, 134 Capture, 87
Release capture, 87
Set capture, 87
B Capture screen, 357
Caret, 244
BACK SPACE key, 250
Index