在Visual Studio宏中是否有等效的DoEvent? [英] Is there an equivalent of DoEvents in Visual Studio macros?

查看:74
本文介绍了在Visual Studio宏中是否有等效的DoEvent?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行时间很长的宏,在其中我将定期消息写入Output,以便用户知道正在发生的事情.问题是直到宏完成后才显示输出(除非您打开继续等待?"对话框,这很奇怪).

I've got a long-running macro, in which I write periodic messages to Output just so that the user know somethings happening. The problem is that the output doesn't get shown until the macro has finished (unless you have the Continue Waiting? dialog box open, strangely enough).

反正还有刷新"事件队列吗?

Is there anyway to 'flush' the event queue?

推荐答案

如果您引用Windows窗体,则可以照常访问Application.DoEvents.

If you reference Windows Forms you can access Application.DoEvents as normal.

我有主IDE响应Windows更新并在宏仍仅运行时实时关闭

I have the main IDE responding to windows updates and closes in real time while the macro is still running with only

    DTE.SuppressUI = False
    Threading.Thread.Sleep(5000)

因此,我建议使用标准的DoEvents&要确保更新UI时,Sleep(55)循环大约250毫秒就可以解决问题,并且SuppressUI=False也可以.

As such I suggest using a standard DoEvents & Sleep(55) loop for a 250 milliseconds or so when you want to ensure the UI is updated should do the trick, along with the SuppressUI=False.

这篇关于在Visual Studio宏中是否有等效的DoEvent?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆