如题。

解决方案 »

  1.   

    Application->ProcessMessages实现的是什么功能?
      

  2.   

    C++ Builder中的说明
    Interrupts the execution of an application so that it can process the event queue.void __fastcall ProcessMessages(void);DescriptionCall ProcessMessages to permit the application to process events that are currently in the queue. Note: ProcessMessages does not allow the application to go idle, whereas HandleMessage does.例子:
    This example uses two buttons that are long enough to accommodate lengthy captions on a form. When the user clicks the button with the caption Ignore Messages, the code begins to generate a long series of random numbers. If the user tries to resize the form while the handler is running, nothing happens until the handler is finished. When the user clicks the button with the caption Process Messages, more random numbers are generated, but the application can still respond to a series of mouse events, such as resizing the form.Note: How quickly these event handlers run depends on the microprocessor of your computer. A message appears on the form informing you when the handler has finished executing.void __fastcall TForm1::FormCreate(TObject* Sender){
      Button1->Caption = "Ignore Messages";
      Button2->Caption = "Handle Message";
    }void __fastcall TForm1::Button1Click(TObject* Sender)
    {
      int x, y;
      for (int i = 0; i < 64000; i++)
     {
        Randomize();
        for (int j = 0; j < 64000; j++)
          y = random(j);
        x = random(i);
      }
      Canvas->TextOut(10, 10, "The Button1Click handler is finished");
    }void __fastcall TForm1::Button2Click(TObject *Sender){
      int x, y;
      for (int i = 0; i < 64000; i++)
      {
        Randomize();
        for (int j = 0; j < 64000; j++)
        {
          y = random(j);
          Application->ProcessMessages();
        }
        x = random(i);
      }
      Canvas->TextOut(10, 10, "The Button2Click handler is finished");
    }谢谢帮忙!
      

  3.   

    应该是这样while (GetMessage(&msg, NULL, 0, 0)) 
    {TranslateMessage(&msg);DispatchMessage(&msg);}
      

  4.   

    同意楼上MSG msg;
    GetMessage(&msg,NULL,0,0);
    PreTranslateMessage(&msg);
      

  5.   

    还有,GetMessage、TranslateMessage和DispatchMessage这些函数可以在文档中使用吗?
      

  6.   

    同意  hahu(地痞 -- 勿近)