private sub read()
Dim buf  As String * 64
Dim stat As Integer
checkid = "abcdefg"
buf = "                                                          "
stat = readbuf(buf, checkid)end sub''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Declare Function readbuf Lib "Newdll.dll" (ByVal buf As String, ByVal Key As String) As Integer怎么 把这段代码 转换成 C#?

解决方案 »

  1.   


            [DllImport("Newdll.dll", EntryPoint = "readbuf")]
            public static extern short readbuf(System.Text.StringBuilder buf, string Key);
    //这样调用
                System.Text.StringBuilder buf = new System.Text.StringBuilder(64);
                string checkid = "abcdefg";
              short st=  readbuf(buf, checkid);
              MessageBox.Show(buf.ToString());