-
Oct 9th, 2018, 09:58 PM
#1
Thread Starter
Member
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
-
Oct 9th, 2018, 10:58 PM
#2
Addicted Member
Re: Lavolpe's subclass
No idea where to find the latest.
But, check this
-
Oct 9th, 2018, 11:10 PM
#3
Re: Lavolpe's subclass
Originally Posted by hennyere
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.).
-
Oct 10th, 2018, 07:58 AM
#4
Re: Lavolpe's subclass
given the stability - SetWindowSubclass is pretty much the standard now
-
Oct 10th, 2018, 08:44 AM
#5
Thread Starter
Member
Re: Lavolpe's subclass
Originally Posted by Victor Bravo VI
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!
-
Oct 10th, 2018, 09:23 AM
#6
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.
-
Oct 10th, 2018, 11:23 AM
#7
Thread Starter
Member
Re: Lavolpe's subclass
Originally Posted by DEXWERX
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|