?
Solved

access a comport

Posted on 2003-03-13
10
Medium Priority
?
1,075 Views
Last Modified: 2012-08-13
how to access a comport in delphi 7 and read a STRING that came from a barcodescanner. i have tried several components but each of them are missing a file to get them to work under delphi 7. the returnvalue has to be a string for easy handling in the rest of the progran
0
Comment
Question by:eagle00789
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
  • 2
10 Comments
 
LVL 3

Expert Comment

by:ILE
ID: 8132408
hex i use the tcomm component just a second u will have that great component on your hand for few seconds

0
 
LVL 3

Expert Comment

by:ILE
ID: 8132467
I hava a lot of work with comports in delphi
and i strongly recomand you this component well documented
good help,free, with full source a lot of corectly working events reability and stability in work

yep i found

http://www.delphi32.com/vcl/lists/sc_n_62.asp 

there a lot of components for serial port but ignore all and take tcomport


i hear there is a newer wersion of tcomport from Dejan Crnila but if u find inform me oki?

dont forget STRONGLY RECOMANDATION

:)))  sory for my english



0
 
LVL 1

Author Comment

by:eagle00789
ID: 8134631
i can't get it to work under delphi 7. i'm missing a file called DsgnIntf.dcu i searched my harddrive for it. but could not find it
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
rl912 earned 255 total points
ID: 8135333
Hello,

try to find AsyncPro of turbopower at sourceforge.org
(search for Turbopower)

should be the solution to your problem.
0
 
LVL 1

Author Comment

by:eagle00789
ID: 8135541
it works.
just one more question: how do i clear the buffer variable??

------

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OoMisc, AdPort, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    ApdComPort1: TApdComPort;
    procedure ApdComPort1TriggerAvail(CP: TObject; Count: Word);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Buffer: string[255];
  BufferIndex: Integer;


implementation

{$R *.dfm}

procedure TForm1.ApdComPort1TriggerAvail(CP: TObject; Count: Word);
var
  I: Word;
  C: Char;
begin
Buffer :=
  for I := 1 to Count do begin
    C := ApdComPort1.GetChar;
    if C = #7 then
      MessageBeep(0)
    else if C in [#32..#126] then begin
      Buffer := Buffer + C;
    end;
  end;
  edit1.text := buffer
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ApdComPort1.Open := True;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
ApdComPort1.Open := False;
end;

end.
0
 
LVL 1

Author Comment

by:eagle00789
ID: 8135542
it works.
just one more question: how do i clear the buffer variable??

------

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OoMisc, AdPort, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    ApdComPort1: TApdComPort;
    procedure ApdComPort1TriggerAvail(CP: TObject; Count: Word);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Buffer: string[255];
  BufferIndex: Integer;


implementation

{$R *.dfm}

procedure TForm1.ApdComPort1TriggerAvail(CP: TObject; Count: Word);
var
  I: Word;
  C: Char;
begin
Buffer :=
  for I := 1 to Count do begin
    C := ApdComPort1.GetChar;
    if C = #7 then
      MessageBeep(0)
    else if C in [#32..#126] then begin
      Buffer := Buffer + C;
    end;
  end;
  edit1.text := buffer
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ApdComPort1.Open := True;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
ApdComPort1.Open := False;
end;

end.
0
 
LVL 1

Author Comment

by:eagle00789
ID: 8135543
it works.
just one more question: how do i clear the buffer variable??

------

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OoMisc, AdPort, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    ApdComPort1: TApdComPort;
    procedure ApdComPort1TriggerAvail(CP: TObject; Count: Word);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Buffer: string[255];
  BufferIndex: Integer;


implementation

{$R *.dfm}

procedure TForm1.ApdComPort1TriggerAvail(CP: TObject; Count: Word);
var
  I: Word;
  C: Char;
begin
Buffer :=
  for I := 1 to Count do begin
    C := ApdComPort1.GetChar;
    if C = #7 then
      MessageBeep(0)
    else if C in [#32..#126] then begin
      Buffer := Buffer + C;
    end;
  end;
  edit1.text := buffer
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ApdComPort1.Open := True;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
ApdComPort1.Open := False;
end;

end.
0
 
LVL 1

Author Comment

by:eagle00789
ID: 8135554
sorry for the multipost. made a mistake
0
 

Expert Comment

by:rl912
ID: 8141631
Hello,

i do : Buffer := '';

0
 
LVL 1

Author Comment

by:eagle00789
ID: 8141978
ok. thx
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question