Thema: Delphi TComPort Problem

Einzelnen Beitrag anzeigen

Benutzerbild von Muellermilchtrinker
Muellermilchtrinker

Registriert seit: 1. Aug 2009
447 Beiträge
 
Delphi 2009 Professional
 
#15

AW: TComPort Problem

  Alt 5. Nov 2010, 15:36
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, CPortCtl, StdCtrls, CPort;

type
  TForm1 = class(TForm)
    ComTerminal1: TComTerminal;
    ComPort1: TComPort;
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    Button3: TButton;
    Edit2: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
comport1.Open;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
comport1.Close;
end;

procedure TForm1.Button3Click(Sender: TObject);
var s:ansistring;
begin
comPort1.Write(pchar(edit1.Text),1);
comport1.Write(#13,1);
s := ansistring(edit2.Text);
comport1.WriteStr(s);
comport1.Write(#13,1);
end;

end.
Chuck Norris doesn't need backups. He just uploads his files and lets the world mirror them.
  Mit Zitat antworten Zitat