6
0
mirror of https://github.com/avast/ioc synced 2024-06-29 18:21:19 +00:00
ioc-collection/VB-Research/vbOpenScript/injector/CSubClass2.cls
2023-01-04 16:31:51 +01:00

84 lines
2.0 KiB
OpenEdge ABL

VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "CSubclass2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'Author: david zimmer <dzzie@yahoo.com>
'Site: http://sandsprite.com
'added 5.17.12 - supports changing the return value to the callers SendMessage()
Event MessageReceived(hwnd As Long, wMsg As Long, wParam As Long, lParam As Long, Cancel As Boolean)
Public ErrorMessage As String
Public ErrorNumber As Long
Private mOverRide As Boolean
Private mVal As Long
Public Windows As New Collection
Friend Function WasOverRidden() As Boolean
WasOverRidden = mOverRide
End Function
Friend Function OverRideVal() As Long
OverRideVal = mVal
End Function
Function OverRideRetVal(newRetVal As Long)
mOverRide = True
mVal = newRetVal
End Function
Function AttachMessage(hwnd As Long, wMsg As Long) As Boolean
On Error GoTo hell
modSubclass.MonitorWindowMessage Me, hwnd, wMsg
AttachMessage = True
ErrorMessage = ""
ErrorNumber = 0
Exit Function
hell:
ErrorMessage = Err.Description
ErrorNumber = Err.Number
End Function
Sub DetatchMessage(hwnd As Long, wMsg As Long)
modSubclass.DetachWindowMessage hwnd, wMsg
End Sub
Private Sub Class_Initialize()
modSubclass.RegisterClassActive Me
End Sub
Private Sub Class_Terminate()
modSubclass.RemoveActiveClass Me
End Sub
Friend Sub ForwardMessage(hwnd As Long, wMsg As Long, wParam As Long, lParam As Long, Optional Cancel As Boolean)
'this sub is only called from the module,
'friend methods are not externally visible in compiled dll interface
mOverRide = False
RaiseEvent MessageReceived(hwnd, wMsg, wParam, lParam, Cancel)
End Sub