想编一个控制读卡机的DLL,请有经验的高手帮助.(200分)

  • 主题发起人 主题发起人 xwfu
  • 开始时间 开始时间
是什么读卡机?用什么接口?如果是IC卡的话既有很简单的读卡
设备,也有通过串口的设备,每种设备编程底层差得比较多.
上层就和你用什么卡有关系了.
 
是IC卡的读卡机,通过串口连接.
 
我编了一个IC卡读卡机的程序,可以编译成exe,但不是DLL.愿意要的话,通知我.
 
to hqpeng:
mail到我的信箱,我先学学.

xwfu@263.net
 
我有BC编的IC卡读写程序,要不?
 
文件已收到,谢谢!
 
to 小天:
BC不太熟,不过可以趁此机会强化,mail 到我的信箱.谢谢大侠.
 
mail to hqpeng:
给我也来一个,谢谢了。
 
to anzhiping:
tell me your email.
 
to anzhiping:
mail 已经发出.
 
to 小天:
你的程序没有收到.
 
我编的是读写磁卡的dll. 呵呵. 用的挺好(供pb调用, 不过接啥程序都可以, 因为读入是模拟成键盘
输入的, 写只要是pchar型的字串就行)
 
接键盘的没什么可编的吧.接com的不太通用.
 
to Another_eYes:
能否给本人一分你的杰作,最好有源程序!顺便问一下,读的是哪种卡?
磁卡格式如何?
 
主要内容如下, dpr很简单, exports就成.
鬼知道是什么类型的磁卡机. 别人只给了我它的格式.
#27+'0':初始化
#27+']':待读
#27+'t':写卡

unit comdevice;

interface

uses Windows, Messages, SysUtils, Classes, Graphics, Controls,async32, forms;


type
TComDevice = class(TWinControl)
public
fparenthandle: Integer;
fCom : TComm32;
FFinished: boolean;
buff: tstringlist;
constructor create(AOwner: TComponent); override;
destructor Destroy; override;
procedure OnGetData(Sender: TObject; Count: Integer);
end;

function InitPort(APort: Word): boolean; stdcall; export;
function ClosePort: boolean; stdcall; export;
function WriteString(Str: Pchar): boolean; stdcall; export;

var
Com_dev: TComdevice;

implementation

function InitPort(APort: word): boolean;
var
initstr : string ;
begin
result := true;
try
if not assigned(Com_Dev) then
Com_Dev := TComDevice.create(Application);
With Com_Dev do
begin
fcom.Close;
fcom.DeviceName := 'COM'+inttostr(Aport);
fcom.BaudRate := cbr9600;
ffinished := false;
fcom.Open;
initstr := #27'0';
fcom.Write(initstr[1], 2);
initstr := #27']';
fcom.write(initstr[1],2);
end;
except
raise Exception.Create('COM port error!');
result := false;
end;
end;

function ClosePort: boolean;
var
s: string;
begin
result := true;
if assigned(com_dev) then
begin
s := #27'0';
com_dev.fcom.write(s[1],2);
com_dev.free;
com_dev := nil;
end;
end;

function WriteString(Str: Pchar): boolean;
var
s: string;
begin
result := false;
if not assigned(com_dev) then
begin
exit;
end;
s := #27'0';
com_dev.fcom.write(s[1], 2);
s := #27']';
com_dev.fcom.write(s[1], 2);
s := #27't'+stringofchar(' ', strlen(str))+#29#27'/';
move(str^, s[3], strlen(str));
com_dev.fcom.write(s[1], length(s));
result := true;
end;

constructor Tcomdevice.create(AOwner: TComponent);
begin
inherited create(AOwner);
fcom := TComm32.Create(self);
fcom.OnRxCharSignal := OnGetData;
end;

destructor Tcomdevice.Destroy;
var
s: string;
begin
fcom.close;
fcom.free;
inherited;
end;

procedure Tcomdevice.OnGetData(Sender: TObject; Count: Integer);
var
i : Integer;
buff: string;
s: string;
begin
fparenthandle := getfocus;
buff := stringofchar(#0, count);
fcom.read(buff[1], count);
i := 1;
while i <= length(buff) do
begin
if buff=#$1b then
inc(i)
else if (i<length(buff)) and (buff = #$3f) and (buff[i+1]=#$1c) then
begin
inc(i);
s := #27'0';
fcom.write(s[1], 2);
s := #27']';
fcom.write(s[1], 2);
exit;
end
else
postmessage(fparenthandle, WM_CHAR, ord(buff), 1);
inc(i);
end;
end;

end.
 
to Another_eYes:
你的程序代码收到,我还得学习几天.先打住.有问题再向你请教.

to 小天:
你的程序到现在还没有收到,等收到后,另行感谢.
 
to me
email:sfxt@vip.sina.com
 
后退
顶部