dcsimg
Results 1 to 7 of 7

Thread: Lavolpe's subclass

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2018
    Posts
    3

    Lavolpe's subclass

    Hi people,

    I've tried a good time to find a clean, well-functioning module that takes advantage of using the memory in a responsible way. I tested several and found this one:

    https://xp-dev.com/sc/114565/512/%2F...0%2FClass1.cls

    Please see the line:
    '\\LaVolpe - Force thunks to replace original window procedure handle. Without this, app can crash when a window is subclassed multiple times simultaneously

    This seemed to work well. I need to know if there is any update for this class.

    Regards,
    Miranda

  2. #2
    Lively Member
    Join Date
    Jun 2018
    Posts
    121

    Re: Lavolpe's subclass

    No idea where to find the latest.
    But, check this

  3. #3
    Addicted Member
    Join Date
    Aug 2017
    Posts
    141

    Re: Lavolpe's subclass

    Quote Originally Posted by hennyere View Post
    I need to know if there is any update for this class.
    I believe LaVolpe has mostly moved on from the traditional SetWindowLong subclassing to the newer Common Controls subclassing APIs (SetWindowSubclass et al.).

  4. #4
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,137

    Re: Lavolpe's subclass

    given the stability - SetWindowSubclass is pretty much the standard now

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2018
    Posts
    3

    Re: Lavolpe's subclass

    Quote Originally Posted by Victor Bravo VI View Post
    I believe LaVolpe has mostly moved on from the traditional SetWindowLong subclassing to the newer Common Controls subclassing APIs (SetWindowSubclass et al.).

    Thank you AMDEXWERX too!


    We have a suite of controls. SetWindowSubclass did not seem to work well

    I'm using the traditional subclass and it seemed to work fine. I have just made a change in the code, because in one of the controls I create a real-time form, and capture events from the parent form. The problem is when the user closes this form and it is the last one. It gets stuck in the windows memory, exactly in the line below:


    If z_ScMem Then 'Ensure that the thunk hasn't already released its memory
    zData(IDX_SHUTDOWN, z_ScMem) = 1 'Set the shutdown indicator
    zDelMsg ALL_MESSAGES, IDX_BTABLE, z_ScMem 'Delete all before messages
    zDelMsg ALL_MESSAGES, IDX_ATABLE, z_ScMem 'Delete all after messages
    End If


    I added the following code and it looks like the problem was bypassed.

    If z_ScMem Then 'Ensure that the thunk hasn't already released its memory
    zData(IDX_SHUTDOWN, z_ScMem) = 1 'Set the shutdown indicator
    zDelMsg ALL_MESSAGES, IDX_BTABLE, z_ScMem 'Delete all before messages
    zDelMsg ALL_MESSAGES, IDX_ATABLE, z_ScMem 'Delete all after messages
    'BY ME
    If zData(IDX_UNICODE, z_ScMem) Then
    SendMessageW thunkID, 0&, 0&, ByVal 0&
    Else
    SendMessageA thunkID, 0&, 0&, ByVal 0&
    End If

    End If

    Am I right in what I'm doing?

    Regards!

  6. #6
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,137

    Re: Lavolpe's subclass

    And that's exactly why we've moved to SetWindowSubclass... no thunks, or extra memory to manage :/

    But I get where you're coming from - a suite of controls, I assume heavily subclassed then. Basically LaVolpe's subclassing works better because of the IDE stability.

    Feel free to try my DLL. The dependency is only needed for debugging.
    Release builds would then use a module and class to replace the DLL. (or not - some people just distribute my DLL with their projects too)

    Sorry I'm not much help. I haven't studied the internals of his subclasser in a long time.

  7. #7

    Thread Starter
    New Member
    Join Date
    Oct 2018
    Posts
    3

    Re: Lavolpe's subclass

    Quote Originally Posted by DEXWERX View Post
    And that's exactly why we've moved to SetWindowSubclass... no thunks, or extra memory to manage :/

    But I get where you're coming from - a suite of controls, I assume heavily subclassed then. Basically LaVolpe's subclassing works better because of the IDE stability.

    Feel free to try my DLL. The dependency is only needed for debugging.
    Release builds would then use a module and class to replace the DLL. (or not - some people just distribute my DLL with their projects too)

    Sorry I'm not much help. I haven't studied the internals of his subclasser in a long time.


    Thank you for your help!


    I'm going to do some tests.
    Last edited by hennyere; Oct 10th, 2018 at 11:33 AM.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width