Partager via


IOleInPlaceComponent.OnEnterState(UInt32, Int32) Method

Definition

Informs an in-place VSPackage object that the environment has entered or left a state.

public:
 void OnEnterState(System::UInt32 dwStateId, int fEnter);
public:
 void OnEnterState(unsigned int dwStateId, int fEnter);
void OnEnterState(unsigned int dwStateId, int fEnter);
public void OnEnterState (uint dwStateId, int fEnter);
abstract member OnEnterState : uint32 * int -> unit
Public Sub OnEnterState (dwStateId As UInteger, fEnter As Integer)

Parameters

dwStateId
UInt32

[in] Identifies the new or prior state. For a list of valid dwStateId values, see _OLECSTATE.

fEnter
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.

Remarks

COM Signature

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.

Applies to