This is a way to wrap the main window of Visual Studio in a klass that implements the IWin32Window interface.
Public Class MainWinWrapper 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
This is useful for example when Visual Studio should be used as the owner of a MessageBox.
Dim res As DialogResult res = MessageBox.Show(New MainWinWrapper(), "Hello!")
The code was found here.