ArcObjects Library Reference

Statements - Get hWnd from ArcGIS Desktop Snippet

Gets the Windows Handle (hWnd) of the ArcGIS Desktop application that is currently running. Note: If you need a Windows Handle for a custom application use System.Runtime.InteropServices.Marshal.GetHINSTANCE instead.

[C#]
                
//<-- Snippet Start -->
// DESCRIPTION:
// Gets the Windows Handle (hWnd) of the ArcGIS Desktop application that is currently
// running. Note: If you need a Windows Handle for a custom application use 
// System.Runtime.InteropServices.Marshal.GetHINSTANCE instead.

int hWnd = m_application.hWnd;

//<-- Snippet End -->
[Visual Basic .NET]
                
'<-- Snippet Start -->
' DESCRIPTION:
' Gets the Windows Handle (hWnd) of the ArcGIS Desktop application that is currently
' running. Note: If you need a Windows Handle for a custom application use 
' System.Runtime.InteropServices.Marshal.GetHINSTANCE instead.

Dim hWnd As Integer = m_application.hWnd

'<-- Snippet End -->


Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Framework