|
-
Dec 29th, 2017, 10:32 PM
#41
Thread Starter
Lively Member
Re: Unicode caption for form: not working with classic or non-themed mode
 Originally Posted by dilettante
Programs should never have an End statement.
In any case the only easy IDE-safe way to handle subclassing is to use a separately compiled DLL that can unsubclass when the class it houses terminates. You could rewrite the subclassing logic as a class in your own DLL or use one provided by somebody else.
I end up with the clsSubClass by Paul Caton and no crash, just need to remove the Unicode validate line in the class. Anyway thank you very much for your support!
Last edited by vietnamvodich; Dec 29th, 2017 at 10:50 PM.
-
Dec 30th, 2017, 12:49 PM
#42
Re: Unicode caption for form: not working with classic or non-themed mode
 Originally Posted by vietnamvodich
I end up with the clsSubClass by Paul Caton and no crash, just need to remove the Unicode validate line in the class.
That's because, in a sense, the thunks used by Paul Caton are 'external' and tests for a pause/stop/break in code to help prevent crashes and allow debugging. Using END in an application, in almost all circumstances, is typically the result of poor coding -- not able to shut down the application properly. Subclassing with the older techniques is hazardous in the IDE. If it doesn't crash in IDE, the same exact scenario shouldn't crash when compiled. Any other scenario can still result in a crash after compiling, whether subclassing exists or not, i.e., unhandled errors, buffer overflows, incorrect usage of CopyMemory API, etc.
Edited: Paul Caton's thunks, IIRC, do not guarantee subclass removal in the proper order. This can be problematic if the same window is subclassed more than once using his thunks or also subclassed outside of your application. The common controls subclassing option offered since at least Win2K take that into consideration. IMO, Caton's solution was ground-breaking at the time and offered VBers mostly-safe subclassing options within the IDE that weren't really available without external DLLs. About the only real advantage to using his thunks nowadays would be for stand-alone classes (class, usercontrol, property page, etc) that do not want a bas module to contain the common controls-type subclassing.
Last edited by LaVolpe; Dec 30th, 2017 at 01:03 PM.
-
Dec 30th, 2017, 01:28 PM
#43
Re: Unicode caption for form: not working with classic or non-themed mode
This was interesting to play with but hardly useful.
You shouldn't be assigning a caption in Elbonian on a North Elbonian computer anyway.
-
Jan 2nd, 2018, 12:11 PM
#44
Re: Unicode caption for form: not working with classic or non-themed mode
Even using a DLL for subclassing can have issues with the END statement. (DbgWProc.DLL for example would reliably crash with End)
If you use my DLL, you can remove the dependency for release builds. Or if you're lazy you can redist VBSubclass.dll like some people here. Unlike DbgWProc it works both compiled and in the IDE, just with less training wheels. It's possible to not crash in the IDE, and still crash when compiled or without the dependency. But that's true of a lot of apps when debugged anyway, as you're less likely to write to protected memory when debugging.
Last edited by DEXWERX; Jan 2nd, 2018 at 12:17 PM.
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
|