📄 readwritecom.pas
字号:
unit ReadWriteCom;
interface
//------------------------------------------------------------------------------
procedure SendToCom1(command : string);
procedure SendToCom2(command : string);
procedure SendToCom3(command : string);
procedure SendToCom4(command : string);
//------------------------------------------------------------------------------
implementation
uses Windows, Dialogs, MainFrm;
//--------------------------Com1实现--------------------------------------------
procedure SendToCom1(command : string);
begin
if Form1.MSComm1.PortOpen then
begin
Form1.MSComm1.Output := OleVariant(command);
end
else
ShowMessage('Com1未打开');
end;
//--------------------------Com2实现--------------------------------------------
procedure SendToCom2(command : string);
begin
if Form1.MSComm2.PortOpen then
begin
Form1.MSComm2.Output := OleVariant(command);
end
else
ShowMessage('Com2未打开');
end;
//------------------------------------------------------------------------------
procedure SendToCom3(command : string);
begin
if Form1.MSComm3.PortOpen then
begin
Form1.MSComm3.Output := OleVariant(command);
end
else
ShowMessage('Com3未打开');
end;
//------------------------------------------------------------------------------
procedure SendToCom4(command :string);
begin
if Form1.MSComm4.PortOpen then
begin
Form1.MSComm4.Output := OleVariant(command);
end
else
ShowMessage('Com4未打开');
end;
//------------------------------------------------------------------------------
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -