所以,我正在尝试创建一个计时器事件(这次在 C++ /clr 中),但我不知道如何定义一个新事件,这就是我得到的:
namespace hook
{
public ref class Tick
{
private:
static System::Timers::Timer^ aTimer;
public:
event EventHandler^ OnTick;
int Interval;
Tick()
{
aTimer = gcnew System::Timers::Timer(Interval);
aTimer->Elapsed += gcnew ElapsedEventHandler(Tick::execute);
}
static void execute(Object^ source, ElapsedEventArgs^ e)
{
this->OnTick(this, new EventsArg()); // Wrong
}
};
}