gpsthrd.cpp

来自「基于USB接口的GPS应用程序」· C++ 代码 · 共 45 行

CPP
45
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "GpsThrd.h"
#include "Gpsfunc.h"

#pragma package(smart_init)
//---------------------------------------------------------------------------

//   Important: Methods and properties of objects in VCL can only be
//   used in a method called using Synchronize, for example:
//
//      Synchronize(UpdateCaption);
//
//   where UpdateCaption could look like:
//
//      void __fastcall Unit1::UpdateCaption()
//      {
//        Form1->Caption = "Updated in a thread";
//      }
//---------------------------------------------------------------------------

__fastcall GpsThrd::GpsThrd(bool CreateSuspended, void *p)
        : TThread(CreateSuspended)
{
 p_gpsfunc = reinterpret_cast<GPS_Func*> (p);
}
//---------------------------------------------------------------------------
void __fastcall GpsThrd::Execute()
{
 while(!Terminated)
 {
   WaitForSingleObject(gpsEvent, INFINITE);
   p_gpsfunc->processMsg();
 } // end of while(
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void __fastcall GpsThrd::DoTerminate()
{
 
 p_gpsfunc->SetThrdStatus(true);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?