Window.HWnd Property
Assembly: EnvDTE (in envdte.dll)
This property is only available if the Window object you call the HWnd property upon was retrieved through DTE.MainWindow. If DTE.MainWindow.HWnd was used, then this returns the handle to the main window of the application. This property can be used to properly set the parent of any dialog box shown by an Add-in or Macro, and can be used by creating an instance of the following VB Macro code, and passing that instance to the ShowDialog method:
Public Class WinWrapper
Implements System.Windows.Forms.IWin32Window
Overridable ReadOnly Property Handle() As System.IntPtr Implements System.Windows.Forms.IWin32Window.Handle
Get
Dim iptr As New System.IntPtr(DTE.MainWindow.HWnd)
Return iptr
End Get
End Property
End Class
Unless the Window object was retrieved by calling DTE.MainWindow, the HWnd property will always return the value 0.
- 6/7/2006
- Craig Skibo - MSFT