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->Caption = "Ignore Messages";
Button2->Caption = "Handle Message";
}</P>
<P>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");
}</P>
<P>void __fastcall TForm1::Button2Click(TObject *Sender)</P>
<P>{
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");
}</P>
页:
[1]