Compartir a través de


OleComponent Class

Definition

Basic implementation of a disposable IOleComponent

public ref class OleComponent : Microsoft::VisualStudio::PlatformUI::DisposableObject, Microsoft::VisualStudio::OLE::Interop::IOleComponent, Microsoft::VisualStudio::Shell::Interop::IVsDiagnosticsItem
[Windows::Foundation::Metadata::WebHostHidden]
class OleComponent : Microsoft::VisualStudio::PlatformUI::DisposableObject, Microsoft::VisualStudio::OLE::Interop::IOleComponent, Microsoft::VisualStudio::Shell::Interop::IVsDiagnosticsItem
public class OleComponent : Microsoft.VisualStudio.PlatformUI.DisposableObject, Microsoft.VisualStudio.OLE.Interop.IOleComponent, Microsoft.VisualStudio.Shell.Interop.IVsDiagnosticsItem
type OleComponent = class
    inherit DisposableObject
    interface IOleComponent
    interface IVsDiagnosticsItem
Public Class OleComponent
Inherits DisposableObject
Implements IOleComponent, IVsDiagnosticsItem
Inheritance
OleComponent
Implements

Remarks

Defines virtual methods for derived classes to override in order to change behavior. Also defines a public event for each method that users can hook into to change behavior without deriving. Default implementations of virtual methods simply raise events in the presence of handlers. If you derive and override the methods and want the events to be raised call the base method before or after your override logic. Will call FRegisterComponent(IOleComponent, OLECRINFO[], UInt32) on construction and and FRevokeComponent(UInt32) on Dispose().

Constructors

OleComponent(IOleComponentManager, String)

Construct an instance of OleComponent. This overload will call FRegisterComponent(IOleComponent, OLECRINFO[], UInt32) automatically on construction.

Properties

DiagnosticsName

Microsoft internal use only.

IsDisposed

Returns whether the object has been disposed once, protects against double disposal

(Inherited from DisposableObject)
IsTrackingComponent

Sets whether this component is the tracking component, accomplished by calling FSetTrackingComponent(UInt32, Int32).

PeriodicIdleTimePeriod

Sets or retrieves the idle time period in milliseconds for this components idle callbacks.

Methods

Activate()

Activates the component, accomplished by calling FOnComponentActivate(UInt32).

BeginTracking()

Makes this IOleComponent the tracking component with its associated IOleComponentManager.

CreateHostedComponent(String)

Creates a new OleComponent instance using Instance as the IOleComponentManager it needs to register itself.

Dispose()

Disposes the current object then suppresses further finalization.

(Inherited from DisposableObject)
Dispose(Boolean)

Standard virtual overload for IDisposable pattern

(Inherited from DisposableObject)
DisposeManagedResources()

Disposes of this object, calling FRevokeComponent(UInt32) if our manager field is non-null and our componentCookie field is not 0.

DisposeNativeResources()

Allows derived classes to provide custom dispose handling for native resources

(Inherited from DisposableObject)
DoOleEvents(IOleComponentManager, Func<Boolean>)

Message pump for an IOleComponentManager.

WARNING: Do not call this method unless it is absolutely necessary, and you know what you are doing. Pumping UI messages can have bad, bad side effects.

See: https://blogs.msdn.com/jfoscoding/archive/2005/08/06/448560.aspx

EndTracking()

Makes this IOleComponent no longer the tracking component with its associated IOleComponentManager.

FContinueMessageLoopCore(UInt32, IntPtr, MSG[])

Default implementation of FContinueMessageLoop. Simply raises the ContinueMessageLoop event if there are any listeners.

FDoIdleCore(UInt32)

Default implementation of FDoIdle. Simply raises the DoIdle and DoPeriodicIdle events as appropriate (based on value of grfidlef) if there are any listeners.

FPreTranslateMessageCore(MSG[])

Default implemmentation of FPreTranslateMessage. Simply raises the PreTranslateMessage event if there are listeners.

FQueryTerminateCore(Int32)

Default implemmentation of FQueryTerminate. Simply raises the QueryTerminate event if there are listeners.

HwndGetWindowCore(UInt32, UInt32)

Default implemmentation of HwndGetWindow. Simply raises the GetWindow event if there are listeners.

OnActivationChangeCore(IOleComponent, Int32, OLECRINFO[], Int32, OLECHOSTINFO[], UInt32)

Default implemmentation of OnActivationChange. Simply raises the ActivationChange event if there are listeners.

OnAppActivateCore(Int32, UInt32)

Default implemmentation of OnAppActivate. Simply raises the AppActivate event if there are listeners.

OnChangeStateCore(UInt32, Int32)

Default implemmentation of OnEnterState. Simply raises the approriate event based on what state changed (described in ComponentState.

OnLoseActivationCore()

Default implemmentation of OnLoseActivation. Simply raises the ActivationLost event if there are listeners.

PushMessageLoop(_OLELOOP, IntPtr)

Pushes this component to the OleComonentManager as the message loop handler by calling FPushMessageLoop(UInt32, UInt32, IntPtr). Message loop blocks until an ContinueMessageLoop handler sets the ContinuePumping /// to false.

TerminateCore()

Default implemmentation of Terminate. Simply raises the Terminate event if there are listeners. Also calls Dispose() and nulls out any reference to a IOleComponentManager that we may have been constructed with.

ThrowIfDisposed()

Throws an ObjectDisposedException if this object has been disposed

(Inherited from DisposableObject)

Events

ActivationChange

Microsoft internal use only.

ActivationLost

Microsoft internal use only.

AppActivate

Microsoft internal use only.

ContinueMessageLoop

Microsoft internal use only.

Disposing

Raised when the event is being disposed, while it is still accessible.

(Inherited from DisposableObject)
DoIdle

Microsoft internal use only.

DoPeriodicIdle

Microsoft internal use only.

GetWindow

Microsoft internal use only.

ModalStateChanged

Microsoft internal use only.

PreTranslateMessage

Microsoft internal use only.

QueryTerminate

Microsoft internal use only.

RecordingStateChanged

Microsoft internal use only.

RedrawOffStateChanged

Microsoft internal use only.

Terminate

Microsoft internal use only.

WarningsOffStateChanged

Microsoft internal use only.

Explicit Interface Implementations

IOleComponent.FContinueMessageLoop(UInt32, IntPtr, MSG[])

Called during each iteration of a message loop that the component pushed. Simply calls through to FContinueMessageLoopCore(UInt32, IntPtr, MSG[]).

IOleComponent.FDoIdle(UInt32)

Called to give a component a chance to do idle time tasks. Component may periodically call FContinueIdle(); if this method returns FALSE (0), component should terminate its idle time processing and return. Simply calls through to FDoIdleCore(UInt32).

IOleComponent.FPreTranslateMessage(MSG[])

Host calls this method on the active component (if its registration info (ComponentRegistrationFlags) indicates it is interested in Pre-translate calls) to give the component a chance to process messages before they are translated and dispatched. The host need not call this method if no component is active. Simply calls through to FPreTranslateMessageCore(MSG[]).

IOleComponent.FQueryTerminate(Int32)

Called when component manager wishes to know if the component is in a state in which it can terminate. Simply calls through to FQueryTerminateCore(Int32).

IOleComponent.FReserved1(UInt32, UInt32, IntPtr, IntPtr)

Reserved slot, not called.

IOleComponent.HwndGetWindow(UInt32, UInt32)

Called to retrieve a window associated with the component, as specified by dwWhich which maps to a value in WindowType. Simply calls through to HwndGetWindowCore(UInt32, UInt32).

IOleComponent.OnActivationChange(IOleComponent, Int32, OLECRINFO[], Int32, OLECHOSTINFO[], UInt32)

Notify component when a new object is being activated. Simply calls through to OnActivationChangeCore(IOleComponent, Int32, OLECRINFO[], Int32, OLECHOSTINFO[], UInt32).

IOleComponent.OnAppActivate(Int32, UInt32)

Notify component when the host application gains or loses activation. Simply calls through to OnAppActivateCore(Int32, UInt32).

IOleComponent.OnEnterState(UInt32, Int32)

Notify component when app enters or exits the state given in uStateID. Simply calls through to OnChangeStateCore(UInt32, Int32).

IOleComponent.OnLoseActivation()

Notify the active component that it has lost its active status because the host or another component has become active. Simply calls through to OnLoseActivationCore().

IOleComponent.Terminate()

Called when component manager wishes to terminate the component's registration. Component should revoke its registration with component manager, release references to component manager and perform any necessary cleanup. Simply calls through to TerminateCore().

Applies to