由於要在Web項目中采用RFID讀取功能
本文方法參考網絡
首先編寫windows控件
如何編寫不再詳述(注意一個地方
重要的類
using System;
using System
namespace RFIDReader
{
public class ReadRfid
{
[DllImport(
private static extern int rf_init_com(int port
[DllImport(
private static extern int rf_request(short icdev
[DllImport(
private static extern int rf_write(int icdev
[DllImport(
private static extern int rf_anticoll(short icdev
[DllImport(
private static extern int rf_ClosePort();
public string CardNum
{
get
{ return getCardNum(); }
}
private string getCardNum()
{
int post =
int i =
byte model =
byte b
short TagType =
byte[] buf
try
{
rf_init_com(post
rf_request(
rf_anticoll(
string s
for (i =
{
s
}
rf_ClosePort();
if (s
{ throw (new Exception()); }
return s
}
catch (Exception)
{
}
return
}
}
}
view sourceprint?
using System;
using System
using System
using System
using System
namespace RFIDReader
{
[ComImport
public interface IObjectSafety
{
[PreserveSig]
void GetInterfacceSafyOptions(
int riid
out int pdwSupportedOptions
out int pdwEnabledOptions);
[PreserveSig]
void SetInterfaceSafetyOptions(
int riid
int dwOptionsSetMask
int dwEnabledOptions);
}
}
using System;using System
using System
using System
using System
using System
using System
using System
namespace RFIDReader{
[Guid(
public partial class Reader : UserControl
{
public Reader()
{
InitializeComponent();
}
#region IObjectSafety 成員
public void GetInterfacceSafyOptions(int riid
{
pdwSupportedOptions =
pdwEnabledOptions =
}
public void SetInterfaceSafetyOptions(int riid
{
throw new NotImplementedException();
}
#endregion
private void timer
{
ReadRfid rfid=new ReadRfid();
string str = rfid
if (str !=
{
textBox
}
}
public int TimerSpan
{
get { return timer
set { timer
} public string CardNum
{
get { return textBox
}
private void GetInfo()
{
this
}
}
}
為了能夠在所有客戶端ie上顯示控件
[assembly: AllowPartiallyTrustedCallers()]
下一步
然後編譯
跟普通的制作安裝程序一樣
鼠標右鍵空白區域
這樣即可生成安裝包了
到現在其實已經可以用了
下載CABARC
cabarc n 生成的cab名
install
[version]
signature=
AdvancedINF=
[Setup Hooks]
hook
[hook
run=msiexec
修改稱自己的安裝文件即可
新建一個web項目
<object id=
codebase=
</object> 這裡的clsid就是自己生成的GUID編號
這裡的RFID使用的是MasterRD
注意
原文鏈接
From:http://tw.wingwit.com/Article/program/net/201311/13644.html