none
GetMessage

    Question

  • 比如在一个耗时的循环操作中,会加入
    1. GetMessage(&msg,NULL,0,0);  
    2. TranslateMessage(&msg);      
    3. DispatchMessage(&msg);
    在记忆中Win32里应该是这样的吧。在Winform里有什么替代的函数吗?

    Wednesday, November 11, 2009 8:20 AM

Answers

  • 你好!
         对于耗时的操作,可以采用异步的方式,具体可以参考:
    http://msdn.microsoft.com/zh-cn/library/ms228963%28VS.80%29.aspx
         希望对你有帮助!
    周雪峰
    • Marked as answer by YiChun Chen Thursday, November 12, 2009 8:59 AM
    Wednesday, November 11, 2009 8:36 AM
  • 你好!

    .Net 2.0 开始提示提供了 BackgroundWorker 控件处理耗时的操作。

    知识改变命运,奋斗成就人生!
    • Marked as answer by YiChun Chen Thursday, November 12, 2009 8:59 AM
    Wednesday, November 11, 2009 10:01 AM
  • 比如在一个耗时的循环操作中,会加入
    1. GetMessage(&msg,NULL,0,0);  
    2. TranslateMessage(&msg);      
    3. DispatchMessage(&msg);
    在记忆中Win32里应该是这样的吧。在Winform里有什么替代的函数吗?


    while(true)
    {
      
      Application.DoEvent(); 或 Thread.Sleep(10);
    }

    • Marked as answer by male110 Thursday, November 12, 2009 12:50 AM
    Wednesday, November 11, 2009 10:02 AM

All replies

  • 你好!
         对于耗时的操作,可以采用异步的方式,具体可以参考:
    http://msdn.microsoft.com/zh-cn/library/ms228963%28VS.80%29.aspx
         希望对你有帮助!
    周雪峰
    • Marked as answer by YiChun Chen Thursday, November 12, 2009 8:59 AM
    Wednesday, November 11, 2009 8:36 AM
  • 你好!

    .Net 2.0 开始提示提供了 BackgroundWorker 控件处理耗时的操作。

    知识改变命运,奋斗成就人生!
    • Marked as answer by YiChun Chen Thursday, November 12, 2009 8:59 AM
    Wednesday, November 11, 2009 10:01 AM
  • 比如在一个耗时的循环操作中,会加入
    1. GetMessage(&msg,NULL,0,0);  
    2. TranslateMessage(&msg);      
    3. DispatchMessage(&msg);
    在记忆中Win32里应该是这样的吧。在Winform里有什么替代的函数吗?


    while(true)
    {
      
      Application.DoEvent(); 或 Thread.Sleep(10);
    }

    • Marked as answer by male110 Thursday, November 12, 2009 12:50 AM
    Wednesday, November 11, 2009 10:02 AM