可以的MessageBox.show原因跨线程异常? [英] Can MessageBox.Show cause cross-thread exceptions?

查看:143
本文介绍了可以的MessageBox.show原因跨线程异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能叫 MessageBox.Show 上一个子线程不必担心跨线程异常?我知道,表面上的回答可以是尝试,并找出,我做到了,成功的,但我注意到,Windows 7的似乎是大约比Windows XP提高跨线程异常不太严格。

Can I call MessageBox.Show on a child thread without worrying about a cross-thread exception? I know the ostensible answer would be "try it and find out", which I did, successfully, but I've noticed that Windows 7 seems to be less strict about raising cross-thread exceptions than Windows XP.

所以,它是随时随地记录,这将是安全的,从一个子线程呢?

So, is it documented anywhere that this would be safe to do from a child thread?

推荐答案

没有,也不会造成任何跨线程的异常。这是因为在MessageBox不是UI线程上运行的类成员。

No, it will not cause any "cross-thread" exceptions. That's because the MessageBox is not a member of a class running on the UI thread.

这篇关于可以的MessageBox.show原因跨线程异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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