|
Thank you, the call is successful, but I do n’t know why I ca n’t adjust the serial port, always return 100
unit Ukq;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class (TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
procedure Button1Click (Sender: TObject);
private
{Private declarations}
public
{Public declarations}
end;
type
TParams = Record
Port: String [3];
CtrlID: String [3]; // Device number, [1 ~ 127]
Params: string [250];
end;
var
Form1: TForm1;
implementation
{$ R * .dfm}
function OpenComm (var lParam: tParams; sType: Integer): Integer; stdcall; external 'CM60.dll';
function CloseComm (var lParam: tParams; sType: Integer): Integer; stdcall; external 'CM60.dll';
procedure TForm1.Button1Click (Sender: TObject);
var
p: TParams;
sType, ret: Integer;
begin
sType: = 2100;
p.Port: = edit1.text;
p.CtrlID: = edit2.Text;
ret: = OpenComm (p, sType);
showmessage (inttostr (ret));
ret: = CloseComm (p, sType);
p.CtrlID: = '';
showmessage (inttostr (ret));
end;
end. |
|