您好,欢迎来到叨叨游戏网。
搜索
您的当前位置:首页timesetevent应用例子

timesetevent应用例子

来源:叨叨游戏网


.cpp

//$$---- Form CPP ----

//---------------------------------------------------------------------------

#include

#include

#pragma hdrstop

#include \"u_TimeEvent.h \"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource \"*.dfm \"

TForm1 *Form1;

int TimeID;

int TimeAccuracy;

int num = 0;

void __stdcall TimeCallProc(UINT TimerID,UINT msg,DWORD dwUser,DWORD a,DWORD b){

TForm1 *eventForm = dynamic_cast (Form1);

String Str;

Str = \"Lines \";

Str += \"----------------- \";

Str += IntToStr(++ num);

eventForm-> Log-> Lines-> Add(Str);

}

//---------------------------------------------------------------------------

__fastcall TForm1::TForm1(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TForm1::StartClick(TObject *Sender)

{

int TimeInterval = 1;

TimeID = timeSetEvent(TimeInterval,TimeAccuracy,&TimeCallProc,1,TIME_PERIODIC);

}

//---------------------------------------------------------------------------

void __fastcall TForm1::StopClick(TObject *Sender)

{

timeKillEvent(TimeID);

}

//---------------------------------------------------------------------------

.h

//$$---- Form HDR ----

//---------------------------------------------------------------------------

#ifndef u_TimeEventH

#define u_TimeEventH

//---------------------------------------------------------------------------

#include

#include

#include

#include

//---------------------------------------------------------------------------

class TForm1 : public TForm

{

__published: // IDE-managed Components

TButton *Start;

TButton *Stop;

TMemo *Log;

void __fastcall StartClick(TObject *Sender);

void __fastcall StopClick(TObject *Sender);

private: // User declarations

public: // User declarations

__fastcall TForm1(TComponent* Owner);

};

//---------------------------------------------------------------------------

extern PACKAGE TForm1 *Form1;

//---------------------------------------------------------------------------

#endif

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- gamedaodao.net 版权所有 湘ICP备2024080961号-6

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务