Size Up Your Applications with Subclassing
Now the hardcore stuff is out the way, we can test this out. Either add a new form or use the one provided, and copy the following code into it:
Option Explicit Private Sub Form_Load() ' Start subclassing FrmHwnd = Me.hwnd FrmDC = Me.hDC OldProc = GetWindowLong(FrmHwnd, GWL_WNDPROC) SetWindowLong FrmHwnd, GWL_WNDPROC, AddressOf WndProc End Sub Private Sub Form_Unload(Cancel As Integer) ' End subclassing SetWindowLong FrmHwnd, GWL_WNDPROC, OldProc End Sub
Page 3 of 4
This article was originally published on November 20, 2002