// Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved
// (DO NOT EDIT: machine generated header) 'KComm.pas' rev: 6.00
#ifndef KCommHPP
#define KCommHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Forms.hpp> // Pascal unit
#include <Windows.hpp> // Pascal unit
#include <Messages.hpp> // Pascal unit
#include <Classes.hpp> // Pascal unit
#include <SysUtils.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Kcomm
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS ECommError;
class PASCALIMPLEMENTATION ECommError : public Sysutils::Exception
{
typedef Sysutils::Exception inherited;
class DELPHICLASS TReadThread;
class DELPHICLASS TKComm;
class PASCALIMPLEMENTATION TKComm : public Classes::TComponent
{
typedef Classes::TComponent inherited;
//Write to comport -------Sync(namely nonoverlaped)
unsigned long k = 0; // use by WriteFile/ReadFile function to return how many bytes are written/read.
char charY = 'Y'; //char to send/receive
WriteFile(hCom, &charY, sizeof(char), &k, NULL);
//Sleep(2000);
//Read from comport -------Sync(namely nonoverlaped)
COMSTAT ComStat;
DWORD dwErrorFlags;
ClearCommError(hCom,&dwErrorFlags,&ComStat);
k = 0;
if( ComStat.cbInQue > 0) //cbInQue是输入队列的长度。
ReadFile(hCom, &charY, sizeof(char), &k, NULL);
if (k) Null;//something been read into tempchar
else GetLastError();