|
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;
pparams = ^ TParams;
var
Form1: TForm1;
implementation
{$ R * .dfm}
function OpenComm (var lParam: pParams; sType: Integer): Integer; stdcall; external 'CM60.dll';
function CloseComm (var lParam: pParams; sType: Integer): Integer; stdcall; external 'CM60.dll';
procedure TForm1.Button1Click (Sender: TObject);
var
p: pparams;
sType, ret: Integer;
begin
sType: = 2100;
p.Port: = '001';
p.CtrlID: = '001';
ret: = OpenComm (p, sType);
showmessage (inttostr (ret));
ret: = CloseComm (p, sType);
p.CtrlID: = '';
showmessage (inttostr (ret));
end;
end.
Edit successfully, when running p.Port: = '001';
p.CtrlID: = '001'; Access address error occurred |
|