This document is archived and information here might be outdated. Recommended version. |
Associated window handle.
[Visual Basic .NET]
Public Property hWnd As Integer
[C#]
public int hWnd {get; set;}
[C++]
HRESULT get_hWnd(
OLE_HANDLE hWnd
);
[C++]
HRESULT put_hWnd(
OLE_HANDLE* hWnd
);
[C++] Parameters hWnd [in]
hWnd is a parameter of type OLE_HANDLE hWnd [out, retval]
hWnd is a parameter of type OLE_HANDLE*
The hWnd property tells ScreenDisplay objects which window to draw in. When a new view (a Map or PageLayout) is created and activated (IActiveView::Activate), a related ScreenDisplay is created and its hWnd is set to that of the main application. Data windows, such as the MapInsetWindow, also have a related ScreenDisplay object and in this case the ScreenDisplay's hWnd property is set so that all drawing will occur in the data window and not the main application window.
Several Windows API calls require an hWnd in order to perform their operation; this property provides the hWnd for the ScreenDisplay object you are currently working with. For example, several of ArcMap's zoom commands use the Windows API function 'GetClientRect' to get the coordinates of the main window's client area. GetClientRect requires the hWnd of the window of interest and in ArcMap's case, IScreenDisplay::hWnd holds this.