Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed
Right it says pick and choose but couldn't find a part that clarified whether whatever I chose had to be placed in a class separate from the one it was targeting, and none of the demos had it self-contained... I did read before asking
Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed
Originally Posted by fafalone
Thanks for clearing it up.
Think I understand the confusion. Where the code goes, doesn't matter as long as it's kept together. The created tasker objects, on the other hand, should always be declared inside the host that will be receiving events from the tasker. That point is repeated over and over again throughout the documentation.
Insomnia is just a byproduct of, "It can't be done"
Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed
Update posted. Required new version, breaking compatibility with any previous versions. The class, sample projects, optional wrappers and documentation all had changes made.
1. Added new thunk/tasker that can allow a VB class, form, etc to "implement" a VTable-only interface. This is similar but significantly different than hooking an existing interface.
2. The logic used to scan host ordinals had a flaw that could fail in some scenarios. Rewrote that routine and is now 14x faster than before, while fixing the flaw.
3. Fixed logic flaw in the VTable-caller tasker when called interface has no parameters.
4. Overhauled error reporting when taskers are created. If an error occurs, the displayed Debug message box will contain a description as to why. When IDE safety options are used, the class will make a one-time check to see what error-breaking options your IDE is set to. If it is set to "Break on Unhandled Errors" then you will get a warning. If applicable, that warning will only occur once for that IDE instance. Basically, it recommends you choose another option. See post #2 for reasons why that option can cause problems for thunks in general.
Last edited by LaVolpe; May 4th, 2020 at 04:19 PM.
Insomnia is just a byproduct of, "It can't be done"
Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed
Well, in my opinion, hooking a VB class within your own project seems pointless. I suspect you have a different reason for asking this? Here is what I suggest first. Read the 2 read-me files: _ReadMe_GeneralInfo and then readme_COMhooks. After you read those, try to put a sample project together. If you are still having problems after that, I'll try to answer them for you.
FYI: A VB class VTable includes 7 entries: IDispatch+IUnknown. The first method in a VB class starts in the 8th VTable slot.
Insomnia is just a byproduct of, "It can't be done"
Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed
Originally Posted by HosseinMoradi
can any pro here confirm this dosn't break anything ?
I can confirm that. In fact, I just found the bug 3 days ago while subclassing a listview control. The option to return your own value when eating a message breaks if that line is not fixed. Until I upload the changes, you can replace the BASE64 code for that thunk.
In the CreateTasker_Subclass function... Here's the updated thunk with the patch
** code removed ** see next post below
Edited: For HosseinMoradi
I was afraid that might have been a copy/paste problem that affected the other thunks too. But it wasn't. I think in the past, I found the error and simply didn't update this one, maybe I changed it for testing purposes & forgot to change it back? Don't recall.
Last edited by LaVolpe; Jul 5th, 2020 at 06:35 PM.
Insomnia is just a byproduct of, "It can't be done"
Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed
Attachments updated.
Patch: Subclassing thunk did not honor the callback return value when EatMessage parameter returned as true. Fixed.
Enhancement: Windows Hook thunk now allows global low-level keyboard and mouse hooks
Thunk versions for the above two were incremented to v4
HosseinMoradi reported that walking through clsThunks had intermittent crashes but those were resolved when the base64 thunk was moved out of a local constant. All thunks were modified to have their base64 thunks added to a declared string vs. constant.
ReadMe documentation updated for Windows Hooks and ASM documentation updated for both subclass/windows hooks.
Insomnia is just a byproduct of, "It can't be done"
Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed
Originally Posted by LaVolpe
Attachments updated.
Patch: Subclassing thunk did not honor the callback return value when EatMessage parameter returned as true. Fixed.
Enhancement: Windows Hook thunk now allows global low-level keyboard and mouse hooks
Thunk versions for the above two were incremented to v4
HosseinMoradi reported that walking through clsThunks had intermittent crashes but those were resolved when the base64 thunk was moved out of a local constant. All thunks were modified to have their base64 thunks added to a declared string vs. constant.
ReadMe documentation updated for Windows Hooks and ASM documentation updated for both subclass/windows hooks.
Sorry for this question, Maybe it's not the right place, sorry...
Is it not possible to capture the events of pressing the stop button or attempting any runtime debugging that does to remove subclassing at that moment?
Some message or event has to happen when the stop or debug button is pressed.
Also, "End" - or "Stop" to go to debugging -, instructions also crash IDE if a subclassing is working, not have any message how WM_DESTROY - in the case of "End" - for capture and remove any working subclassing?
Any ideas?
The thunk apply to capture mousewheel in VB6 is possible?
Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed
In this examples of vbaccelerator - I download years ago all the vbaccelerator codes, at now not is possible download, I not know why vbaccelerator erase the downloads -, appear to be is made a subclassing that not crash qhe stop vb6 button or debug button is pressed, I put in attach...
(If any want all (I believe have all, not totally sure, but is possible have all) the codes of vbaccelerator, is possible for me upload to one of my webs and put a link in this forum)
Is how this??? With this subclassing not crash the ide??? I check, and when press stop or debug button not crash...
Is neccesary put in windows/system32 the dlls SSubTmr6.dll and vbalHook6.dll and register...
Last edited by James Reynolds; Apr 21st, 2023 at 09:24 AM.
Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed
Originally Posted by James Reynolds
In this examples of vbaccelerator - I download years ago all the vbaccelerator codes, at now not is possible download, I not know why vbaccelerator erase the downloads -, appear to be is made a subclassing that not crash qhe stop vb6 button or debug button is pressed, I put in attach...
(If any want all (I believe have all, not totally sure, but is possible have all) the codes of vbaccelerator, is possible for me upload to one of my webs and put a link in this forum)
Is how this??? With this subclassing not crash the ide??? I check, and when press stop or debug button not crash...
Is neccesary put in windows/system32 the dlls SSubTmr6.dll and vbalHook6.dll and register...
I test in one of my Programs and is very easy, I want to capture the MouseWheel event in VB6:
1.- Add Reference to the SSubTmr6.dll
2.- At Init of the Code of a Form I Write for Capture the MouseWheel:
AttachMessage Me, Me.anycontrol.hwnd, WM_MOUSEWHEEL
'Is possible Add Others Controls or Add Other Messages or Both
4.- In Any Part of the code of the form I Write:
Code:
Private Property Let ISubClass_MsgResponse(ByVal RHS As EMsgResponse)
'
End Property
Private Property Get ISubClass_MsgResponse() As EMsgResponse
ShowMessage "ISubClass_MsgResponse: CurrentMessage=" & CurrentMessage
ISubClass_MsgResponse = emrPostProcess
End Property
Private Function ISubClass_WindowProc(ByVal hwnd As Long, ByVal iMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
ShowMessage "ISubClass_WindowProc: hWnd=" & hwnd & ", iMsg=" & iMsg & ", wParam=" & wParam & ", lParam=" & lParam
End Function
Private Sub ShowMessage(ByVal msg As String)
'This code is only for know the Hwnd that has received the MouseWheel
'Because is possible Subclassing Many Controls - or the Form - and Many Messages
'And also Know the wParam
'If wParam is possitive, the MouseWheel is Up, if Negative the MouseWheel is Down
A1% = InStr(msg, "wParam=") + Len("wParam=")
A2% = InStr(msg, ", lParam=")
wParam& = Mid$(msg, A1%, A2% - A1%)
B1% = InStr(msg, "hWnd=") + Len("hWnd=")
B2% = InStr(msg, ", iMsg=")
hWnd2& = Mid$(msg, B1%, B2% - B1%)
'After, Any Code you Want
End Sub
With this easy code, can be subclass any control with any messages you like without crash the IDE when press Stop or Debug Buttons in the IDE... And with only a simple reference to the "SSubTmr6.dll" that is in the link: https://www.vbforums.com/attachment....8&d=1682087077
Greentings...
Last edited by James Reynolds; Apr 21st, 2023 at 11:49 PM.