代码大致如下:
procedure TCom.ReadCom(var buffer: string; var dwCount: Cardinal);
var
  dwNum:Cardinal;
begin
  dwNum:=DWORD(-1);
  ReadFile(Handle,buffer,1024,dwNum,nil);
  dwCount := dwNum;procedure TComThread.Execute;
var
 lpBuffer:string;
  dwCount:Cardinal;
  pcmd:pCommand; //pcommand为一命令包指针
if com = nil then
  begin
    raise exception.Create('!!!!');
  end;
  while (not Suspended) do
  begin                         
    com.ReadCom(lpBuffer,dwCount);  if dwCount>0 then       pcmd := PCommand(lpBuffer);DWCOUNT中有值,但LPBUFFER无效,且串口测试过,工作正常,PCMD^中老是取不到值。