Book description
Subclassing & Hooking with Visual Basic offers developers a unique way to customize Windows behavior.Windows is a message-based system. Every action you request creates one or more messages to carry out the action. These messages are passed between objects and carry with them information that gives the recipient more detail on how to interpret and act upon the message.With Subclassing and the Windows hooking mechanism ("hooks"), you can manipulate, modify, or even discard messages bound for other objects within the operating system, in the process changing the way the system behaves. What kinds of results can you achieve using the power of subclassing and hooking? Here are just a few of the possibilities:
- Determine when a window is being activated or deactivated and respond to this change.
- Display descriptions of menu items as the mouse moves across them.
- Disallow a user to move or resize a window.
- Determine where the mouse cursor is and respond accordingly.
- Determine when the display resolution has been changed.
- Monitor the system for a low system resource condition.
- Modify or disallow keystrokes sent to a window or a control.
- Create an automated testing application.
- Determine when an application is idle.
Publisher resources
Table of contents
- Subclassing and Hooking with Visual Basic
- A Note Regarding Supplemental Files
- Preface
- I. Introducing Subclassing and Hooking
-
II. Subclassing and Superclassing
- 4. Subclassing
-
5. Subclassing the Windows Common Dialog Boxes
- How Common Dialog BoxSubclassing Works
- Using the Resource
- Creating the Subclassing Application
- Subclassing Common Dialog Boxes Other Than Open and Save As
- Problems Subclassing the Find and Replace Common Dialogs
- 6. ActiveX Controls and Subclassing
- 7. Superclassing
- 8. Debugging Techniques for Subclassing
- III. Hooking
- IV. The .NET Platform
-
V. Appendixes
-
A. Messages
-
Window Messages
- Public Const WM_NULL = &H0
- Public Const WM_CREATE = &H1
- Public Const WM_DESTROY = &H2
- Public Const WM_MOVE = &H3
- Public Const WM_SIZE = &H5
- Public Const WM_ACTIVATE = &H6
- Public Const WM_SETFOCUS = &H7
- Public Const WM_KILLFOCUS = &H8
- Public Const WM_SETTEXT = &HC
- Public Const WM_PAINT = &HF
- Public Const WM_QUIT = &H12
- Public Const WM_ERASEBKGND = &H14
- Public Const WM_SHOWWINDOW = &H18
- Public Const WM_SETCURSOR = &H20
- Public Const WM_QUEUESYNC = &H23
- Public Const WM_GETMINMAXINFO = &H24
- Public Const WM_WINDOWPOSCHANGING = &H46
- Public Const WM_WINDOWPOSCHANGED = &H47
- Public Const WM_CANCELJOURNAL = &H4B
- Public Const WM_NCCREATE = &H81
- Public Const WM_NCDESTROY = &H82
- Public Const WM_NCCALCSIZE = &H83
- Public Const WM_NCHITTEST = &H84
- Public Const WM_NCPAINT = &H85
- Public Const WM_NCACTIVATE = &H86
- Public Const WM_GETDLGCODE = &H87
- Public Const WM_NCMOUSEMOVE = &HA0
- Public Const WM_NCLBUTTONDOWN = &HA1
- Public Const WM_NCLBUTTONUP = &HA2
- Public Const WM_NCLBUTTONDBLCLK = &HA3
- Public Const WM_NCRBUTTONDOWN = &HA4
- Public Const WM_NCRBUTTONUP = &HA5
- Public Const WM_NCRBUTTONDBLCLK = &HA6
- Public Const WM_NCMBUTTONDOWN = &HA7
- Public Const WM_NCMBUTTONUP = &HA8
- Public Const WM_NCMBUTTONDBLCLK = &HA9
- Public Const WM_NCXBUTTONDOWN = &HAB
- Public Const WM_NCXBUTTONUP = &HAC
- Public Const WM_NCXBUTTONDBLCLK = &HAD
- Public Const WM_KEYDOWN = &H100
- Public Const WM_KEYUP = &H101
- Public Const WM_CHAR = &H102
- Public Const WM_SYSKEYDOWN = &H104
- Public Const WM_SYSKEYUP = &H105
- Public Const WM_SYSCHAR = &H106
- Public Const WM_INITDIALOG = &H110
- Public Const WM_COMMAND = &H111
- Public Const WM_SYSCOMMAND = &H112
- Public Const WM_ENTERIDLE = &H121
- Public Const WM_CTLCOLOREDIT = &H133
- Public Const WM_CTLCOLORLISTBOX = &H134
- Public Const WM_CTLCOLORBTN = &H135
- Public Const WM_CTLCOLORDLG = &H136
- Public Const WM_CTLCOLORSCROLLBAR = &H137
- Public Const WM_CTLCOLORSTATIC = &H138
- Public Const WM_MOUSEMOVE = &H200
- Public Const WM_LBUTTONDOWN = &H201
- Public Const WM_LBUTTONUP = &H202
- Public Const WM_LBUTTONDBLCLK = &H203
- Public Const WM_RBUTTONDOWN = &H204
- Public Const WM_RBUTTONUP = &H205
- Public Const WM_RBUTTONDBLCLK = &H206
- Public Const WM_MBUTTONDOWN = &H207
- Public Const WM_MBUTTONUP = &H208
- Public Const WM_MBUTTONDBLCLK = &H209
- Public Const WM_XBUTTONDOWN = &H20B
- Public Const WM_XBUTTONUP = &H20C
- Public Const WM_XBUTTONDBLCLK = &H20D
- Public Const WM_PARENTNOTIFY = &H210
- Public Const WM_ENTERMENULOOP = &H211
- Public Const WM_EXITMENULOOP = &H212
- Public Const WM_SIZING = &H214
- Public Const WM_CAPTURECHANGED = &H215
- Public Const WM_MOVING = &H216
- Public Const WM_ENTERSIZEMOVE = &H231
- Public Const WM_EXITSIZEMOVE = &H232
- Public Const WM_HOTKEY = &H312
- Button Control-Specific Messages
- Combo Box-Specific Messages
- Edit Control-Specific Messages
- Listbox-Specific Messages
- Scroll Bar-Specific Messages
- Messages Specific to the CommonDialog Boxes
- Messages Specific to the Font Common Dialog Box
- Messages Specific to the Page Setup Common Dialog Box
-
Window Messages
-
B. API Functions
- AttachThreadInput
- BroadcastSystemMessage
- CallNextHookEx
- CallWindowProc
- ChooseColor
- ChooseFont
- CopyMemory
- CreateWindowEx
- DefWindowProc
- EnumChildWindows
- FindText
- FindWindow
- FindWindowEx
- GetClassInfoEx
- GetDeskTopWindow
- GetDlgItem
- GetMessage
- GetParent
- GetSaveFileName
- GetWindow
- GetWindowLong
- GetWindowRect
- OutputDebugStringA
- PageSetupDlg
- PeekMessage
- PostMessage
- PostQuitMessage
- PostThreadMessage
- PrintDlg
- PrintDlgEx
- RegisterClassEx
- RegisterWindowMessage
- ReleaseCapture
- ReplaceText
- SendDlgItemMessage
- SendMessage
- SendMessageCallback
- SendMessageTimeout
- SendNotifyMessage
- SetCapture
- SetClassLongPtr
- SetWindowLongPtr
- SetWindowPos
- SetWindowsHookEx
- ShowWindow
- UnhookWindowsHookEx
- UnregisterClass
-
C. Structures and Constants
- CBT_CREATEWND
- CBTACTIVATESTRUCT
- CHOOSECOLOR
- CHOOSEFONT
- CWPRETSTRUCT
- CWPSTRUCT
- DEBUGHOOKINFO
- EVENTMSG
- FINDREPLACE
- KBDLLHOOKSTRUCT
- MOUSEHOOKSTRUCT
- MOUSEHOOKSTRUCTEX
- MSG
- MSLLHOOKSTRUCT
- NMHDR
- OPENFILENAME
- PAGESETUPDLG
- POINTAPI
- PRINTDLG
- PRINTDLGEX
- RECT
- WNDCLASSEX
- Message (.NET Structure)
-
Constants
- BroadcastSystemMessage Function Masks
- Common Dialog Box Error Messages
- Common Dialog Box Notification Messages
- Class Styles
- Edit Control Notification Codes
- Extended Window Styles
- GetClassLongPtr Function Constants
- GetWindow API Function Constants
- GetWindowLongPtr Function Constants
- Hook Codes
- HSHELL_ACCESSIBILITYSTATE Constants
- Key State Masks for Mouse Messages
- Low-Level Hook Constants
- Mouse Wheel Constant
- Open and Save As Common Dialog BoxNotification Codes
- PeekMessage Function Options
- PostMessage and SendMessage Function Constants
- Predefined Control ID Values for the Open andSave As Common Dialog Boxes
- SendMessageTimeout API Function Constants
- SetWindowLongPtr/GetWindowLongPtr Function Constants
- SetWindowPos Function Constants
- ShowWindow Function Constants
- User Button Notification Codes
- Virtual Key Codes
- Window Hook Constants
- Window Styles
- WM_KEYUP, WM_DOWN, andWM_CHAR lParam HIWORD Flags
- WM_NCHITTEST Codes
- WH_SHELL Codes for the HSHELL_APPCOMMAND Hook Code
- WM_SIZE Message wParam Values
- WM_SYSCOMMAND Message wParam Constants
- XButton Constants
-
A. Messages
- Index
- About the Author
- Colophon
- Copyright
Product information
- Title: Subclassing and Hooking with Visual Basic
- Author(s):
- Release date: June 2001
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781491932681
You might also like
book
COM+ Programming with Visual Basic
The importance of a book like COM+ Programming with Visual Basic lies in the fact that …
book
Programming in the .NET Environment
is the software developer's guide to the .NET Framework. The authors describe Microsoft's vision for distributed …
book
Windows Forms 2.0 Programming
“Some books are different-the content can't be Googled from the Internet, the authors have real-life experiences …
book
Data Binding with Windows Forms 2.0: Programming Smart Client Data Applications with .NET
“Brian Noyes’ writing style easily captures your attention as he elaborates on all aspects of data …