Application.DoEvents();多次调用会有什么隐患,望有经验的朋友分享下!
public static void Delay(uint ms)
{
uint start = GetTickCount();
while (GetTickCount() - start < ms)
{
Application.DoEvents();
}
}
这样的确没有出现假死情况。
但是网上有些人说 Application.DoEvents()调用多次后会存在隐患。希望有经验的大神给点指点,用过的朋友分享下经验,看是否到底真会出现异常吗,出现怎样的异常?
还有别人数用Timer可以替代Sleep,希望有实例的朋友可以贴下!!
相关推荐
C# Application.DoEvents() 防界面假死例子。
请自行测试有Application.DoEvents() 和没有Application.DoEvents()的区别,即可。 有疑问可发送Email给我: Andrew.Wangxu@gmail.com
c#语言的doevents示例
doevents处理需要两次按钮点击才能实现功能,其实质是第一次点击使得引发doevents的事件失去焦点,第二次才是进入期待的按钮事件,所以需要在进入引用doevents的按钮时,先要使用focus命令失去焦点,外部按钮才会在第一次点击时就能得到触发。
DoEvents语句的API升级版Doevents2
DoEvents语句的API升级版Doevents2
消息循环重载实例doevents
消息循环重载实例,doevents,基于c++编写,欢迎下载!!
ekho包含多个语音报,调用看描述
Application.DoEvents(); //SpeechSynthesizer synth = new SpeechSynthesizer(); //synth.SelectVoice("Microsoft Simplified Chinese"); Type type = Type.GetTypeFromProgID("SAPI.SpVoice"); dynamic spVoice = Activator.CreateInstance(type); for (int i = 0; i < spVoice.GetVoices(string.Empty, string.Empty).Count; i++) { if (spVoice.GetVoices(string.Empty, string.Empty).Item(i).GetDescription(0) == "ScanSoft Sin-Ji_Full_22kHz") { spVoice.Voice = spVoice.GetVoices(string.Empty, string.Empty).Item(i); } } spVoice.Rate = 3; spVoice.Speak("无资料");


