This method toggles a per-instance switch for event delivery.
When events are frozen, the browser continues to operate normally and
still generates events internally, but your application will not be
notified of them. The events are not queued while frozen; they are
discarded. For developers familiar with COM controls, this mirrors the
behavior of IOleControl::FreezeEvents. When you unfreeze,
only new events that occur after unfreezing will be delivered.
Event freezing can be useful when:
- You are running scripted or programmatic operations that would
otherwise flood your event handler, such as multiple page redirects
or rapid AsyncExecute calls.
- You are making a series of user interface changes and want to
avoid reentrant updates. For example, temporarily stopping focus
and/or size change events while moving or resizing controls.
- You are showing a modal dialog or performing work where event
reentrancy could complicate state management.
- You need to suppress event-driven logic during controlled
navigation, such as "silently" reloading a document or
navigating to a new location.
Freezing does not alter browser state, navigation, or timers; it
only affects your application's callback. To resume normal
notifications, call this method with the bFreezeEvents
parameter as zero. Freezing events will not affect calls to
WaitForEvent. Because freezing events does not prevent
browser events from occurring, they are still processed internally and
you can wait for a specific event to complete.
If you discover that subsequent notifications within an event
handler would interfere with your application's workflow, it is safe
to freeze events from within the handler. After completing the operation,
unfreeze events (for example, by posting an application-defined message
or using a timer) so events resume normally. You should avoid calling
DisableEvents from within an event handler, use freezing
instead.