//此段代码在delphi7中能够初始端口,但是在2005中不行
uses IcCard;
procedure TFrmViewMain.FormShow(Sender: TObject);
var
icDev:LongInt;
begin
icDev:=rf_init(0,9600);
if icDev<>0 then
begin
ShowMessage('端口初始化失敗,請重新啟計算機');//'端口初始化失敗,請重新啟計算機');
exit;
end;
end;
//引用dll的单元
unit IcCard;
interface
uses
windows;
function rf_init(port: smallint;baud:longint): longint; stdcall;
implementation
function rf_init; stdcall ;external 'mwrf32.dll';
end.