H
handsome1234
Unregistered / Unconfirmed
GUEST, unregistred user!
Mcs_sr.dll的函数的原型:
WORD MCS_InitComm(
BYTE _bPort = 0,
DWORD _dwCommBaudRate = 115200
);
返回值
如果函数调用成功,返回值为0。
如果函数调用失败,返回值不为0。
我在delphi中如下调用:
implementation
// Function functionname(argment):Boolean;far;External 'DllName';
Function MCS_InitComm(_bPort : BYTE = 0 ;_dwCommBaudRate : DWORD = 57600 ):WORD;far;External 'Mcs_sr.dll' name 'MCS_InitComm';
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
Result_MCS_InitComm :WORD;
bb:byte;
DWaaWORD;
begin
bb:=1;
DWaa:=57600;
Result_MCS_InitComm:=MCS_InitComm(bb,DWaa);
// Result_MCS_InitComm:=MCS_InitComm(1,57600);//也不行,返回代码也是33
writeln('Result_MCS_InitComm',int(Result_MCS_InitComm));
Readln;
end;
end.
能正常运行:Result_MCS_InitComm,但是的返回值为33,根据错误代码查表说是:
函数调用参数错误。不知是哪有问题????
WORD MCS_InitComm(
BYTE _bPort = 0,
DWORD _dwCommBaudRate = 115200
);
返回值
如果函数调用成功,返回值为0。
如果函数调用失败,返回值不为0。
我在delphi中如下调用:
implementation
// Function functionname(argment):Boolean;far;External 'DllName';
Function MCS_InitComm(_bPort : BYTE = 0 ;_dwCommBaudRate : DWORD = 57600 ):WORD;far;External 'Mcs_sr.dll' name 'MCS_InitComm';
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
Result_MCS_InitComm :WORD;
bb:byte;
DWaaWORD;
begin
bb:=1;
DWaa:=57600;
Result_MCS_InitComm:=MCS_InitComm(bb,DWaa);
// Result_MCS_InitComm:=MCS_InitComm(1,57600);//也不行,返回代码也是33
writeln('Result_MCS_InitComm',int(Result_MCS_InitComm));
Readln;
end;
end.
能正常运行:Result_MCS_InitComm,但是的返回值为33,根据错误代码查表说是:
函数调用参数错误。不知是哪有问题????