请问怎样用C#来写调用485的IC读卡器的DLL!!

hanzhuang639 2006-03-16 09:20:46
Declare Function PowerOn Lib "硬件的DLL名" () As Integer //上电函数
Declare Function PowerOff Lib "硬件的DLL名" () As Integer //下电函数

Declare Function OpenComm Lib "硬件的DLL名" (ByVal nPort As Integer) As Integer //打开端口函数
Declare Function CloseComm Lib "硬件的DLL名" () As Integer //关闭端口函数
Declare Function GetState Lib "硬件的DLL名" (ByVal nPort As Integer) As Integer

Declare Function IC_ATR Lib "硬件的DLL名" (ByVal DataBuffer As String) As Integer //卡片复位请求函数
Declare Function IC_ReadMain Lib "硬件的DLL名" (ByVal Offset As Integer, ByVal Length As Integer, ByVal DataBuffer As String) As Integer //'读储主存器的函数
Declare Function IC_ReadProtect Lib "硬件的DLL名" (ByVal DataBuffer As String) As Integer //读保护储存器
Declare Function IC_ReadSecurity Lib "硬件的DLL名" (ByVal DataBuffer As String) As Integer //读保密储存器
Declare Function IC_ReadErrorCount Lib "硬件的DLL名" () As Integer //读错误计数器

Declare Function IC_WriteMain Lib "硬件的DLL名" (ByVal Offset As Integer, ByVal Length As Integer, ByVal DataBuffer As String) As Integer //写主储存器的函数
Declare Function IC_WriteProtect Lib "硬件的DLL名" (ByVal Offset As Integer, ByVal Length As Integer, ByVal DataBuffer As String) As Integer //写保护储存器的函数
Declare Function IC_updateSM Lib "硬件的DLL名" (ByVal Offset As Integer, ByVal Length As Integer, ByVal DataBuffer As String) As Integer
Declare Function IC_ChangePass Lib "硬件的DLL名" (ByVal PassWord As String) As Integer //更改密码函数
Declare Function IC_PSCCheck Lib "硬件的DLL名" (ByVal DataBuffer As String) As Integer //密码校验函数


等等函数,只要想做什么样的功能都可以按这样的模式往下写


我想把上面用VB写的改成C#的!!!!!!1
有人会吗?
...全文
168 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
20011521 2006-03-17
  • 打赏
  • 举报
回复
多试一试就行了
20011521 2006-03-17
  • 打赏
  • 举报
回复
[Visual Basic]
Imports System.Runtime.InteropServices
Public Class Win32
<DllImport ("user32.dll", ExactSpelling := False)> _
Public Shared Function MessageBox (ByVal hWnd As Integer, _
ByVal txt As String, ByVal caption As String, _
ByVal Typ As Integer) As Integer
End Function
End Class
[C#]
using System.Runtime.InteropServices;
public class Win32 {
[DllImport("user32.dll", CharSet=CharSet.Unicode,
ExactSpelling=true)]
public static extern int MessageBoxW(int hWnd, String text, String
caption, uint type);
}
20011521 2006-03-17
  • 打赏
  • 举报
回复
[DllImport("硬件的DLL名.dll",CharSet=CharSet.Ansi)]
public static unsafe extern uint PowerOn();

[C#]
using System.Runtime.InteropServices;
public class Win32 {
[DllImport("user32.dll", CharSet=CharSet.Unicode,
ExactSpelling=true)]
public static extern int MessageBoxW(int hWnd, String text, String
caption, uint type);
}

110,568

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧