' Create a new ActiveX DLL project, name Smartsubclasslib
' The following code is placed in the standard module, the module name Msmartsubclass
' ----------------------------------------------------
' Module Msmartsubclass
'
' Version ... 1.0
' Date ... April 2001
'
' Copyright (C) 2001 Andr anecdote Pons (andres@vbsmart.com)
' ----------------------------------------------------
' API declarations:
Option Explicit
Public Const Ssc_oldproc = "Ssc_oldproc"
Public Const ssc_objaddr = "Ssc_objaddr"
Private Declare Function getprop Lib "user32" Alias "Getpropa" (_
ByVal HWnd as Long, _
ByVal lpstring as String) as Long
Private Declare Sub copymemory Lib "kernel32" Alias "RtlMoveMemory" (_
Destination as Any, _
Source as Any, _
ByVal Length as Long)
'
' Function Startsubclasswindowproc ()
'
' This is the ' WindowProc ' receives messages
' For all subclassed windows.
' The aim ' 's ' is ' to just collect the message
' and deliver it to the right Smartsubclass instance.
'
Public Function Smartsubclasswindowproc (_
ByVal HWnd as Long, _
ByVal umsg as Long, _
ByVal WParam as Long, _
ByVal LParam as Long) as long
Dim Lret as Long
Dim Osmartsubclass as Smartsubclass
"Get" memory address of the class instance ...
Lret = Getprop (hWnd, SSC_OBJADDR)
If Lret <> 0 Then
' Osmartsubclass ' to the class instance
' Without incrementing the class reference counter ...
CopyMemory Osmartsubclass, Lret, 4
' Send the message to the class instance ...
Smartsubclasswindowproc = Osmartsubclass.windowproc (HWnd, _
Umsg, WParam, LParam)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.