漫画搜,白河县政府网,人生励志篇章
大二做b/s架构的项目使用了安衡电子秤chs-d+r和一款扫码枪,两个设备的串口使用一样,这款电子秤是相当的坑,没有开发的api,无奈只能自己开发activex了,在b/s架构中进行引用activex的guid能够达到使用本地串口的最终目的.
activex中首先要进行安全签名的设置
[comimport, guidattribute("cb5bdc81-93c1-11cf-8f20-00805f2cd064")]
[interfacetypeattribute(cominterfacetype.interfaceisiunknown)]
public interface iobjectsafety
{
[preservesig]
int getinterfacesafetyoptions(ref guid riid, [marshalas(unmanagedtype.u4)] ref int pdwsupportedoptions, [marshalas(unmanagedtype.u4)] ref int pdwenabledoptions);
[preservesig()]
int setinterfacesafetyoptions(ref guid riid, [marshalas(unmanagedtype.u4)] int dwoptionsetmask, [marshalas(unmanagedtype.u4)] int dwenabledoptions);
}
下面进行activex的开发
private void serialport_datareceived(object sender, serialdatareceivedeventargs e)
{
//string str = serialport.readline();
//receivetbox1.text += str;
string str = serialport.readline();
textbox3.text = str.substring(7);
}
public string getdata()
{
string str = serialport.readline();
return str;
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论