BUG: Visual Studio .NET macro dialog boxes appear behind the Visual Studio .NET IDE (312877)
The information in this article applies to:
- Microsoft Visual Studio .NET (2002), Professional Edition
- Microsoft Visual Studio .NET (2003), Professional Edition
This article was previously published under Q312877 SYMPTOMS Dialog boxes, such as those that are displayed by the OpenFileDialog class, might appear behind the Visual Studio .NET integrated
development environment (IDE) when these dialog boxes are used in macros. No
icon appears in the task bar to indicate that the new window exists.
RESOLUTION You can use ALT+TAB to find dialog boxes. You can
also write a wrapper that fixes the problem, as in the following example. This
codes uses the WinWrapper class to set the proper parent for any window that you display
from a macro.
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.MacrosIDE.MainWindow.HWnd)
Return iptr
End Get
End Property
End Class
To see how a macro uses this Winwrapper sample, you can look at the AddClassicComRef() sample that comes with Visual Studio .NET. - On the Visual Studio .NET Tools menu, point to Macros, and then click Macro Explorer.
- In the Macro Explorer window, double-click Samples to expand the list.
- Double-click Utilities, and then find AddClassicComRef in the code that appears. You will see that it declares a WinWrapper pointer:
Dim winptr As WinWrapper
Next, the code initializes the pointer:
winptr = New WinWrapper()
The pointer is then passed to ShowDialog:
If openfile.ShowDialog(winptr) = result.OK Then
- Change the preceding code line to:
If openfile.ShowDialog() = result.OK Then
The dialog box will then appear behind the integrated development
environment.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 1/26/2006 |
---|
Keywords: | kbvs2005doesnotapply kbvs2005swept kbtshoot kbvs2002sp1sweep kbbug kbnofix KB312877 kbAudDeveloper |
---|
|