'********************************************************************************************
'Documentation to the Standard DLL "dssubcls.dll"  (c) 2002 by J. Thuemmler, Delphin Software
'********************************************************************************************
'++++++++++++++++++++++  This DLL is Freeware and provided "As Is"  +++++++++++++++++++++++++
'********************************************************************************************
Purpose of the DLL:

Subclassing of a foreign application or any of its windows as follows:

1. Changing the window style of the target window or

2. Subclassing the window procedure of the target window; it means, the DLL sends a
copy of each message to your app (you'll get it passed by a function call). 
If you call "UseSendMessage 1", you'll be able to intercept or modify the messages.

To use the DLL, just put it into your program/project folder. Don't place it in the system
folder because of the use of shared memory. The use is at your own risc.
'--------------------------------------------------------------------------------------------
How it works:

When the function "SubClass&()" is called, a hook will be installed on the strange thread and
the DLL is injected into the threads address space. After that, the instance of the DLL
(which is now inside of the strange thread) calls the function "SetWindowLong()" with the
parameters which you have set when the DLL function was called. If you are subclassing the
target window, the new window procedure is inside of the DLL, and from this procedure you'll
get the informations as a call of a public function, which your app must provide in a 
standard module (see remarks below).
'********************************************************************************************
Function declaration:

Declare Function SubClass& Lib "dssubcls" (ByVal HwndSubclass&, _
                                  Optional ByVal Address& = 0, _
                                  Optional ByVal OldStyle& = 0, _
                                  Optional ByVal NewStyle& = 0, _
                                  Optional ByVal Ext& = 0, _
                                  Optional ByVal SubClass& = 0)
'--------------------------------------------------------------------------------------------
Parameters:

HwndSubclass&
Handle of the foreign window to be subclassed or
0 (Zero) to release the hook.

In case of subclassing, you should call the function passing "0" when your app closes. The
DLL takes care and restores the original window procedure, but it is better style ...


Address&
The address of a public function in your program, which must reside in a standard module and 
will be called from the DLL, passed using "AddressOf Callback":

Public Function Callback&(ByVal msg&, ByVal wParam&, ByVal lParam&)

The passed parameters are a copy of the original message; in case of "UseSendMessage 1" the
original message will be passed, and you can suppress or modify it.

NOTE:
In case of using the DLL for changing the window style, you don't need this callback function 
and set Address& = 0. 


OldStyle& (Default: 0 (Zero))
When you are using the DLL for changing the window style, a style which is to be removed can
be specified here. Use the according constants ("WS_XXX" or "WS_EX_XXX") or several, by use
of "Or" operator combined constants/values.


NewStyle&
The new or to be added window style (to set just like for OldStyle). You can pass 0 (Zero),
if you only want to remove any old style.


Extended& (0 or 1)
0 for normal window style, 1 for extended window style.

NOTE:
Some (much) styles may be set only at creation time of a window and cannot be changed later. 


SubClass& (0 or 1)
0, if you want to change the window style,
1, if you want to subclass the strange window procedure.
If "SubClass&" = 0, you don't need a callback and must set "Address& = 0" too.
If "SubClass&" = 1, all other parameters except for "HwndSubclass&" and "Address&" are
ignored.
'--------------------------------------------------------------------------------------------
Return value:

1 in case of success, otherwise 0 (Zero).
'********************************************************************************************
Function declaration:

Declare Function SetParams& Lib "dssubcls" (Optional ByVal msg& = 0, _
                                            Optional ByVal wParam& = 0, _
                                            Optional Byval lParam& = 0)
'--------------------------------------------------------------------------------------------
Parameters:

msg&, wParam&, lParam&
If "UseSendmessage 1" was called, these parameters will replace the original parameters of
the window procedure call. To suppress a message, simply call "SetParams". To modify a 
message, pass the respective parameters.
If "UseSendmessage 1" was not called, a call of this function will take no effect.
'--------------------------------------------------------------------------------------------
Return value:

Always True (1).
'********************************************************************************************
Function declaration:

Declare Function UseSendMessage& Lib "dssubcls" (ByVal use&)
'--------------------------------------------------------------------------------------------
Parameters:

use& (0, 1)
By default, the DLL uses "SendNotifyMessage()" to send the message copy from the hooked
instance to the calling application. This is for a safe handling, but has a disadvantage:
When a message below WM_USER uses a pointer, the call will fail and the message is lost
(e.g. WM_SETTEXT). If you need to monitor all messages, you must call this function with
use& = 1. Then the DLL uses "SendMessage()", but consider the fact that in this case the code
in your callback function must be processed before the message gets to the window procedure 
of the target window, and this may cause undefined behaviour depending on the code.
Call the function with use& = 0 to go back to "SendNotifyMessage()".
An advantage is, that you'll be able to suppress or modify the messages when calling this
function passing "1" (see function "SetParams()").   
'--------------------------------------------------------------------------------------------
Return value:

Always True (1).
'********************************************************************************************
Delphin Software
Mail:  delphinsoft@gmx.de
Phone: 049 7251 18671
'********************************************************************************************
