This document is archived and information here might be outdated. Recommended version. |
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
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.