Summary of Key Points in Subclassing
This chapter presented a great deal of information about subclassing. Before proceeding on to the following chapters, make sure that you have a solid grasp of the concepts presented in this chapter. These concepts will be used throughout the rest of the book. To help with this, the following is a list of key points mentioned in the course of this chapter:
Use
OnErrorResumeNextfor error handling in the subclassed window procedure.Do as little work as possible in the subclassed window procedure.
Stepping through a subclassing application in the IDE can be problematic.
Subclassed window procedures and other callback functions must reside in a BAS module.
Define the subclassed window procedure and any other callback functions as Public.
Do not end an application before removing all subclassed window procedures.
Do not use the
Endstatement in your code or the Stop button in the VB IDE.Never lose the function pointer to the original window procedure for the subclassed window.
Do not use the DoEvents function within any window procedure.
Thoroughly research the messages that you will be trapping in the subclassed window procedure. Each message has its own little quirks.
To allow the window to perform the default processing for a message, it must be passed on to the original window procedure (CallWindowProc) or to the default window procedure (DefWindowProc).
Instance subclassing affects a specific window and its window procedure. Global subclassing ...
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.
Read now
Unlock full access