Swapping over duplicate subclass procedures - perils?

Got some subclass procedures which log information to global Q's.
Every so often I need to process these global Q's and save them to disk whilst still not missing any of the msg that the subclass procedures trap.
So one idea is to swap over to mirror subclass procedures which log to mirror global Q, that way I can process the information in the 1st lot of global Q's.

Apart from the milliseconds taken whilst the 0{PROP:WndProc} = mirroredsubclassprocedureaddress takes place are there any other things to worry about which might crop up, by swapping subclass procedures on the fly periodically?

Each sub class procedure, both original and mirrored add to their own global Q, so there's no synching taking place, where more time can be lost waiting.

I'm also under the impression, but it could be wrong, that subclassing is normally something performed for the life of the app, and not something switched around routinely.

Seems like if all you want to do is process some output queues, maybe you just want an output class of some kind that you can swap out, while leaving all of the other stuff alone.

I’m avoiding classes to remove the procedure method overheads. I’ve got multiple subclass procedures which all trap for different things and even this will be merged into just one giant subclass procedure, once the code is sorted to minimise the procedure jumps.

I’m trying to optimise as much as a possible because this slow laptop is highlighting things I hadnt noticed on faster machines, even though all the apps run at the relative same speed.

Whatever the thing is that you’ve created, then, if not classes. Why not just change the queue the non-oop output whatever-you-want-to-call-it instead of replacing the subclassing?

The message queue is not reentrant; it is a queue. You wont get the next message u til this one is complete.

So go ahead and save what you want to disk. The next message will be waiting for you when you are done.

Its a good idea, but the IF statement directing the msgs to the other queue would amount to more cpu time, where as a periodic switch to a different sub class procedure is just a few lines of (M$) code.

So pause the subclassing then? I didnt know that could be done, but that would work during the switch to a mirro subclass procedure, at least I wont miss any messages, but the time spent processing and saving to disk is long, and I need to act on some of the the msgs in realtime, whilst logging all of them for traceability.

Once saved to disk the rest of the processing can take place at a more leisurely pace.

There’s different kinds of saving. All you have to do is save it to a buffer somewhere where it can be saved to disk at your leisure. It doesn’t have to do a lot of work.

Have you considered sending the message to OutputDebugString (ODS) there are many tools that allow you to look at the ODS messages and also save them to disk. I’m a fan of DebugViewPP

Btw my debugger class has a method that will show the Name of a WM_ message - and another method for Event() names - it’s actually the same undocumented RTL call with a special offset for event(). It’s especially interesting as it names some WM_ messages which are SV specific

The offset is 0A000H for C6+, and 1400H for C6 and earlier
the class will confirm those values, and hunt for new ones
it will save what it finds to an INI

see ClarionCommunity/CW/Shared/Src/debuger.clw at master · MarkGoldberg/ClarionCommunity

It depends what you’re subclassing

if it’s the frame then sure, it’s very likely going to be the lifetime of the app

But if it’s a window, or a control on a window then clearly the lifetime needs to end when the window is closed (or the control is destroyed)

Its both app frame and window. I’ve punted some of the code into a seperate window and thread, so reduce the workload when shutdown’s occur as thats when there is the most activity.

I’m experimenting with SendMessage/RegisterWindowMessageA for all windows concerned, mainly because when a SendMessage is called, it jumps to the thread and window in question, and is processed straight away which is ideal for what I want.

I did wonder what scope Address would use for subclassed procedures, so it seems to look for local procedures first and global procedures second, which is helpful.

I’ll bear the debugger class in mind, but its looking like I’ll just pause the subclassing and see how that fairs in real world.