IOleInPlaceComponent.OnEnterState Method (UInt32, Int32)
Informs an in-place VSPackage object that the environment has entered or left a state.
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Parameters
- dwStateId
-
Type:
System.UInt32
[in] Identifies the new or prior state. For a list of valid dwStateId values, see _OLECSTATE.
- fEnter
-
Type:
System.Int32
[in] Flag that is set to true to indicate that the environment is entering the state specified by dwStateId and false to indicate that it is exiting the state.
From oleipc.idl:
void IOleInPlaceComponent::OnEnterState( [in] DWORD dwStateId, [in] BOOL fEnter );
The environment calls the OnEnterState method to notify in-place objects that a change in state has occurred. If dwStateID is set to olecstateOnModal, a modal dialog has been displayed. In-place objects should disable their windows appropriately. Only non-component control in-place objects are notified of modal state changes with OnEnterState. Component control in-place objects are notified through EnableModeless.
To notify the environment that an in-place object is entering the modal state, the object must call OnUIComponentEnterState and set the dwStateId parameter to olecstateOnModal. The environment is responsible for notifying all of the other in-place objects for which it is responsible about the state change.
When the dwStateId parameter is set to olecstateOnRedrawOff in OnEnterState, this indicates that the in-place object should disable screen painting. This state is typically entered programmatically by a Visual Basic for Applications programmer setting an application property. The object can respond to this state change in one of two ways:
By hiding its top-level windows without forcing an immediate repaint. When screen painting is once again enabled, the in-place object can force a repaint.
By trapping all WM_PAINT messages, setting a flag without repainting if a message is received while painting is disabled. When screen painting is again enabled, the in-place object can rely on the flag to determine if a repaint is necessary.
When the dwStateId parameter is set to olecstateOnWarningsOff, this indicates that the in-place object should disable the display of warning messages to the user. The environment typically enters this state programmatically when a Visual Basic for Applications programmer sets an application property. The in-place object immediately executes its default response to the current situation, whatever that might be, rather than displaying a message. For example, if the in-place object is currently closing, it should save any unsaved changes and then close. The object should not display a dialog asking if the user wants to save the changes.