Page 2 of 2 FirstFirst 12
Results 41 to 56 of 56

Thread: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed

  1. #41
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,651

    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

    Thanks for clearing it up.

  2. #42

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed

    Quote Originally Posted by fafalone View Post
    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"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #43

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #44
    Hyperactive Member
    Join Date
    Jun 2016
    Location
    España
    Posts
    506

    Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed

    very good work,
    It works perfect

    Greetings

  5. #45
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed

    I haven't had time to test it. But I have great admiration and thanks for any improvements on Subclassing. Much appreciated, LaVolpe.

  6. #46
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed

    how to hook vb6 class1?
    dim a as new class1 ,have events,hook class1.test1?
    class1.cls code
    Code:
    sub test()
    msgbox "class1"
    end sub
    function sum(a ,b)
    sum=a+b
    end function

  7. #47

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #48
    New Member
    Join Date
    Aug 2019
    Posts
    12

    Exclamation Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed

    found a breaking bug in all versions of Factory Subclasser after v2.
    the value set to SubclassProc is always returned 0.
    Last edited by HosseinMoradi; Jun 25th, 2020 at 02:11 PM.

  9. #49
    New Member
    Join Date
    Aug 2019
    Posts
    12

    Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed

    i think i found the issue.

    Code:
    je		._cleanup
    must become
    Code:
    jne		._cleanup
    i test it and it fixed the issue.

    can any pro here confirm this dosn't break anything ?

  10. #50

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed

    Quote Originally Posted by HosseinMoradi View Post
    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"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  11. #51

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  12. #52
    Lively Member
    Join Date
    Jan 2008
    Posts
    67

    Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed

    Quote Originally Posted by LaVolpe View Post
    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?

  13. #53
    Lively Member
    Join Date
    Jan 2008
    Posts
    67

    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...
    Attached Files Attached Files
    Last edited by James Reynolds; Apr 21st, 2023 at 09:24 AM.

  14. #54
    Lively Member
    Join Date
    Jan 2008
    Posts
    67

    Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed

    I not find the source codes of the SSubTmr6 Last Version with ASM code, in vbaccelerator is here, but the link not work, any have???
    http://www.vbaccelerator.com/home/VB...n/article.html

    And use Thunk, the title of the page is:
    "SSubTimer - ASM Thunk Version"

    Any have the zip with the source - VB6 ASM SSubTimer Full Source.zip (39K) -:
    http://www.vbaccelerator.com/home/VB...ll_Source.html

    But the link to the zip not work, I consider these attitudes of deleting codes, bad arts, not good faith...

    (The zip I attached i the prev message is only the dll of the VB6_ASM_SSubTimer, but not find the source, grrr, If any have, many thanks!!!)

  15. #55
    Lively Member
    Join Date
    Jan 2008
    Posts
    67

    Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed

    Well, good, I find in github!!!
    https://github.com/tannerhelland/vbA...ull_Source.zip

    I upload if any like...

    I changed also in the links in 2 prev message...
    Attached Files Attached Files
    Last edited by James Reynolds; Apr 21st, 2023 at 09:25 AM.

  16. #56
    Lively Member
    Join Date
    Jan 2008
    Posts
    67

    Re: [vb6] IDE-Safety Thunks for subclassing, hooking and more: A new breed

    Quote Originally Posted by James Reynolds View Post
    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:
    Code:
    '==========MOUSE WHEEL===============
    Private Const WM_MOUSEWHEEL = &H20A
    
    Implements ISubclass
    Private m_emr As EMsgResponse
    '===========================
    3.- At Form_Load I Write:
    Code:
    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.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width