This document is archived and information here might be outdated.  Recommended version.


IActiveView.Activate Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IA > IActiveView Interface > IActiveView.Activate Method
ArcGIS Developer Help

IActiveView.Activate Method

Gives this view control of the specified window.

[Visual Basic .NET]
Public Sub Activate ( _
    ByVal hWnd As Integer _
)
[C#]
public void Activate (
    int hWnd
);
[C++]
HRESULT Activate(
  OLE_HANDLE hWnd
);
[C++]
Parameters
hWnd 

hWnd is a parameter of type OLE_HANDLE

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

Called to establish the current object as the active view.  For example, view commands deactivate (IActiveView::Deactivate) the current view (IMxDocument::ActiveView) before calling Activate on their own associated view. 

When working with the IActiveView interface on a MapDocument object, you should always first call IActiveView::Activate() in order to properly initialize the display of the PageLayout or Map object. The MxDocument and MapServer objects and the MapControl and PageLayoutControl all initialize display objects automatically after opening an MXD, but MapDocument does not do this, so you should call Activate() before working with any other members of IActiveView.   If your application has a user interface, you should call Activate() with the hWnd of the application's client area.  If your application runs in the background and has no windows, you can always get a valid hWnd from the GDI GetDesktopWindow() function, part of the Win32 API.

See Also

IActiveView Interface