Series of 4 progressively
complex native callback/subclassing examples for VB
This series of
VB5 projects demos how to create WinAPI callbacks and route them
through a class module for greater encapsulation and reusability.
Calltim1.vbp is an extremely simple example and each project
builds on what is demonstrated in the previous project. If you
want to learn about subclassing and callbacks, this is a good
place to start! After learing these techniques, you will be ready
to move on to more advanced subclassing and callback techniques
with a greater understanding of what your code is actually doing.
CallTimer1
Download (2.5k) VB source here!
Techniques demonstrated in Calltim1.vbp
--------------------------------------- |
| -Writing
a callback function to receive a notification message
from the Win32 system |
CallTimer2
Download (3.5k) VB source here!
Techniques demonstrated in Calltim2.vbp
--------------------------------------- |
- One
method of routing a WinAPI callback message through a
class module
- Routing win32 messages to VB Events
- Passing a copy of a class object to a bas module
- Calling back to the class object from the bas module |
CallTimer3
Download (4.5k) VB source here!
Techniques demonstrated in Calltim3.vbp
--------------------------------------- |
- Keeping
track of multiple class objects with an array
- Routing Win32 messages to correct Class module
- Cleaning up Class resources with Destroy method |
EZSubclasser Full Sample App
Download (5k) VB source here!
Advanced sample uses implemented
interface to route ALL Window messages to VB forms
- even forms created at runtime!
Techniques demonstrated in
ezSubclass.vbp
--------------------------------------- |
-Using Setwindowlong() to subclass a window
-Using an Interface to call back to a class instance
-Using GetProp() and SetProp() to attach a class
instanceto an hwnd
-Using RTLMoveMemory() to create a class instance from an
ObjPtr |
You may freely use and modify this code in your
own programs. However, you may not redistribute
this archive without permission from Ray Mercer
<raymer@shrinkwrapvb.com>
Copyright (c) 1998-2000, Ray Mercer, All Rights Reserved