求救!

解决方案 »

  1.   

    使用这样的函数: 
        BOOL CheckMessageQueue() 
        { 
         MSG msg; 
         
         while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){ 
         if(msg.message==WM_QUIT) 
         return FALSE; 
         TranslateMessage(&msg); 
         DispatchMessage(&msg); 
         } 
         return TRUE; 
        } 
        该函数可以实现DoEvents的效果。但有一点不同,如果该函数返回FALSE,说明用户按下了关闭按钮。
      

  2.   

    Sleep不能代替,Sleep挂起当前线程序,而这个不会!
      

  3.   

    textnext(最爱秋天)东西是对的!
      

  4.   

    BOOL CheckMessageQueue() 
        { 
         MSG msg; 
         
         while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){ 
         if(msg.message==WM_QUIT) 
         return FALSE; 
         TranslateMessage(&msg); 
         DispatchMessage(&msg); 
         } 
         return TRUE; 
        } 
    void processmsg()
    {
    for(;CheckMessageQueue();
    {
    //Loop Empty;
    }
    }
    这样用更好用!
      

  5.   

    楼上的写得很好, VCL里的ProcessMessages基本上就是这样
      

  6.   

    恕我很菜,这个函数 到底怎么用???
    我试了一下,在程序中 直接加  processmsg() ,结果一直在  for(;CheckMessageQueue();) 这一行循环, 而不能执行别的任务了。