Execution Control and Environment - danielep71/VBA-PERFORMANCE_MANAGER GitHub Wiki
Execution Control and Environment
This page explains the execution-control and environment-management members of cPerformanceManager.
These members are not the primary elapsed-time measurement API. Instead, they control:
- short pauses and waiting strategies
- explicit cleanup of environment changes made by the class
- safe object-lifecycle patterns when using timer-resolution changes or shared TW participation
Members covered here
PauseResetEnvironment
Pause
Pause delays execution for a requested duration using one of several strategies:
cPM.Pause dSeconds, [iMethod]
Supported pause methods:
1 = Sleep API2 = Timer + DoEvents loop3 = Application.WaitElse = Now + DoEvents loop
Pause is a utility.
It is not a precision scheduler.
ResetEnvironment
ResetEnvironment is the explicit cleanup routine:
cPM.ResetEnvironment
It currently handles:
- timer-resolution cleanup for method 3 when relevant
- shared TW cleanup if this instance is participating
Best practice
Treat ResetEnvironment as the main cleanup contract.
Treat Class_Terminate only as a fallback safety net.