powerbuilder 发表于 2004-7-15 16:57

Borland C++ Builder 与 Visual Basic『DoEvents』同样功能的函式

<P>与 Visual Basic『DoEvents』同样功能的函式</P>
<P>//Application.ProcessMessages </P>
<P>void __fastcall TForm1::FormCreate(TObject* Sender)</P>
<P>{
  Button1-&gt;Caption = "Ignore Messages";
  Button2-&gt;Caption = "Handle Message";
}</P>
<P>void __fastcall TForm1::Button1Click(TObject* Sender)
{
  int x, y;
  for (int i = 0; i &lt; 64000; i++)
{
    Randomize();
    for (int j = 0; j &lt; 64000; j++)
      y = random(j);
    x = random(i);
  }
  Canvas-&gt;TextOut(10, 10, "The Button1Click handler is finished");
}</P>
<P>void __fastcall TForm1::Button2Click(TObject *Sender)</P>
<P>{
  int x, y;
  for (int i = 0; i &lt; 64000; i++)
  {
    Randomize();
    for (int j = 0; j &lt; 64000; j++)
    {
      y = random(j);
      Application-&gt;ProcessMessages();
    }
    x = random(i);
  }
  Canvas-&gt;TextOut(10, 10, "The Button2Click handler is finished");
}</P>
页: [1]
查看完整版本: Borland C++ Builder 与 Visual Basic『DoEvents』同样功能的函式