日期:2014-05-17  浏览次数:20479 次

asp.net 调用读卡器的DLL
我们都知道asp.net程序是放在服务器上的,但是读卡机是在客户端的,当客户读卡机连接到客户点电脑,我如何通过这个读卡机提供的Dll操作读卡器呢?说白了就是通过网页调用客户端的DLL访问一些外界设备!求各味大虾伸出援手。

------解决方案--------------------
如果你的DLL是COM组件的话,可以通过脚本调用,但可能IE会阻止调用,需要把安全选项设置低一些

至于怎么调用COM组件,你可以上网找找
------解决方案--------------------
说实话,不好实现,相信我。
做成ocx
------解决方案--------------------
C# code

读卡器dll的接口函数: 
  int   open_comm(int   comm_id); 
  int   CardReady(long   *snr); 
调用的方法是: 
  [DllImport( "...WM_Mifare.dll ",   CharSet   =   CharSet.Ansi)]\\dll是绝对路径 
public   static   extern   int   open_comm(string       comm_id); 

            public   int     InitReaderDll(string     comm_id) 
                {           
                                return   open_comm(comm_id);         
                } 


[DllImport( "E:\\.....WM_Mifare.dll ",   CharSet   =   CharSet.Ansi)]\\dll是绝对路径 
                public   static   extern   int   CardReady(string   snr); 

                public   int   DllReader(string   snr) 
                {     
                                return   CardReady(snr); 
                } 

调用指令: 
private   void   button2_Click(object   sender,   EventArgs   e) 
                { 
                        this.skclass.InitReaderDll(a); 
                              this.skclass.DllReader(i); 
                        this.textBox3.Text   =   i; 
                } 


int   open_comm(int   comm_id); 
  int   CardReady(long   *snr); 

对应: 
public   static   extern   int   open_comm(int   comm_id); 
public   static   extern   int   CardReady(ref   long   snr);

------解决方案--------------------
activeX
------解决方案--------------------
activeX