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 IntegerDeclare 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
有人会吗?

解决方案 »

  1.   

    [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);
    }
      

  2.   

    [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);
    }