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


IScreenDisplay.hWnd Property (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Display)  

IScreenDisplay.hWnd Property

Associated window handle.

[Visual Basic .NET]
Public Property hWnd As Integer
[C#]
public int hWnd {get; set;}
[C++]
HRESULT get_hWnd(
  long* hWnd
);
[C++]
HRESULT put_hWnd(
  long hWnd
);
[C++]

Parameters hWnd [out, retval] hWnd is a parameter of type long hWnd [in] hWnd is a parameter of type long

Product Availability

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

Remarks

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.

See Also

IScreenDisplay Interface