This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IA > IActiveView Interface > IActiveView.Activate Method (ArcObjects .NET 10.5 SDK) |
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(
long hWnd
);
[C++]
Parameters hWnd hWnd is a parameter of type long
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.