unit3.cpp

来自「并口测试程序」· C++ 代码 · 共 52 行

CPP
52
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit3.h"
#include "Unit1.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 TInputThread::UpdateCaption()
//      {
//        Form1->Caption = "Updated in a thread";
//      }
//---------------------------------------------------------------------------
        BYTE inportb(WORD port);
        void MySleep(DWORD dwMicrosecond);
        extern int nInput;
        extern AnsiString sInput;
__fastcall TInputThread::TInputThread(bool CreateSuspended)
        : TThread(CreateSuspended)
{
        Priority = tpNormal;
        FreeOnTerminate = true;
        Resume();
}
//---------------------------------------------------------------------------
void __fastcall TInputThread::Execute()
{
        while(!Terminated)
        {
        sInput = IntToBin(inportb(0x379));
        Form1->LabeledEdit4->Text = sInput[29];
        Form1->LabeledEdit5->Text = sInput[28];
        Form1->LabeledEdit6->Text = sInput[27];
        Form1->LabeledEdit7->Text = sInput[26];
        Form1->LabeledEdit8->Text = sInput[25];
        MySleep(100000);
                if(!nInput)
                        Terminate();

        }
}
//---------------------------------------------------------------------------
 

⌨️ 快捷键说明

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