启动对话框时 Visual Studio 2010 宏挂起

发布于 2024-11-03 07:33:55 字数 937 浏览 5 评论 0原文

我写了一个 启动一个对话框,用户可以在其中从组合框中选择一个值。不幸的是,对话框显示,我得到一个 1 到 20 秒的沙漏。

我发现了一些似乎有帮助的解决方法:

  1. 快速按 CTRL-Alt-Del,然后按 Escape。
  2. 单击任务栏中的旋转宏动画。
  3. 从任务栏最小化然后最大化对话框。

然而,这真的很痛苦,有谁知道是什么原因导致这种情况以及我如何防止挂起?

我用来启动对话框的代码

    Dim winptr As New WinWrapper()
    frm.ShowDialog(winptr)

'' This class is used to set the proper parent to any UI that you may display from within 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.MainWindow.HWnd)
            Return iptr
        End Get
    End Property
End Class

I have written a Macro which launches a dialog where the user selects a value from a combo box. Unfortunately the dialog box shows and I get an hourglass for between 1 and 20 seconds.

There are a couple of workaronds I have found which seem to help:

  1. A quick CTRL-Alt-Del followed by Escape.
  2. Clicking on the spinning macro animation in the task bar.
  3. Minimising and then maximising the dialog from the taskbar.

However this is getting to be a real pain, does anyone know what is going on to cause this and how I can prevent the hanging?

The code I am using to launch the dialog is

    Dim winptr As New WinWrapper()
    frm.ShowDialog(winptr)

and

'' This class is used to set the proper parent to any UI that you may display from within 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.MainWindow.HWnd)
            Return iptr
        End Get
    End Property
End Class

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

羁拥 2024-11-10 07:33:55

每当我的宏调用 MsgBox 函数时,我都会遇到类似的挂断。
重新运行宏几次后,挂起似乎消失了(这可能暗示了错误是什么),但这也不是一个可行的解决方案。

I get simular hangups whenever my macros call the MsgBox function.
It seems that the hangups disapear after rerunning the macro a few times (This may be a hint to what the bug is) but thats not a workable solution either.

清醇 2024-11-10 07:33:55

如果您安装 SP1,则会修复多个错误,包括修复 VS 2010 挂起和 Visual studio“虚拟内存不足错误”

If you install SP1 there are several bug fixes including a fix for VS 2010 hanging and the Visual studio "Out of Virtual memory Error"

放血 2024-11-10 07:33:55

我认为 Visual Studios 2010 宏不支持 Winforms。

http://msdn.microsoft.com/en-us/library/bxk3af4y.aspx

VS 宏当前不支持 Windows 窗体。

I thought Visual Studios 2010 macros do not support Winforms.

http://msdn.microsoft.com/en-us/library/bxk3af4y.aspx

VS Macros do not currently support Windows Forms.

你在我安 2024-11-10 07:33:55

由于某种原因关闭 VS 宏编辑器基本上可以解决我的问题。我仍然看到 2 到 3 秒的延迟。

Closing the VS Macro Editor for some reason mostly corrects the problem for me. I still see delays of 2 to 3 seconds.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文