3

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
Community
  • 1
  • 1
openshac
  • 4,966
  • 5
  • 46
  • 77
  • I tried setting up your macro, and it works perfectly for me (very useful btw!) no delays or anything... that's with VS2010 SP1, so perhaps worth installing the SP if you haven't... – Fergus Bown May 26 '11 at 16:11
  • Thanks I tried installing SP1 and it doesn't seem to have made a difference :-( – openshac Jun 01 '11 at 08:22

4 Answers4

1

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.

David R.
  • 11
  • 1
  • Yeah that's exactly what I get, but it's strange because some of the other developers don't have any problems at all. – openshac Aug 07 '11 at 17:06
  • Same behavior for me using MsgBox() and using InpuxBox(), VS2010, all updates applied to date. – Samuel Nov 26 '12 at 17:14
0

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

Samuel
  • 8,063
  • 8
  • 45
  • 41
0

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"

jcpennypincher
  • 3,970
  • 5
  • 31
  • 44
  • Thanks I tried installing SP1 and it doesn't seem to have made a difference :-( – openshac Jun 01 '11 at 08:22
  • Sorry to hear that, unfortunately, solving a slight performance issue is often hard to do unless you are looking at the system itself. Does it have enough RAM? are there other programs running? Is something pegging the disc I/O? There are many factors to consider. One thing that is quite useful on Windows is Process Explorer. That can help you isolate issues http://technet.microsoft.com/en-us/sysinternals/bb896653 – jcpennypincher Jun 01 '11 at 18:08
  • #jcpennypincher thanks for the suggestion. I'm not sure it's a performance thing as the workarounds I suggested above work instantly. However if it's of relevance I have 4GB of RAM and 2GHz processor running on a 64-bit OS - this should be enough to launch a dialog immediately. However I'll give Process Explorer a whirl and see if it comes up with anything. – openshac Jun 02 '11 at 07:42
0

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.

surfasb
  • 968
  • 1
  • 13
  • 31