Re: Unicode caption for form: not working with classic or non-themed mode
Quote:
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!
Re: Unicode caption for form: not working with classic or non-themed mode
Quote:
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.
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.
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.