主题:请教C#调用VB写的DLL出错:无法找到入口!
VB写的DLL代码
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function sendtwp Lib "sourdll.dll" (ByVal SendHdc As Long, ByVal Com As Long, _
ByVal number As Long, ByVal Scr_Width As Long, ByVal Scr_Height As Long, _
ByVal inmode As Long, ByVal Speed As Long, ByVal DispTime As Long, ByVal colorswap As Long, _
ByVal rgswap As Long) As Boolean
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
Dim WithEvents p1 As VB.PictureBox
Public Function sendledA(ByVal Sendstr As String, ByVal LedNumber As Integer) As Boolean
Dim J
p1.Width = 192
p1.Height = 48
p1.FontName = "宋体"
p1.FontSize = 11
p1.ForeColor = RGB(255, 255, 0)
Dim str(3) As String
str(0) = Sendstr
str(1) = str(0)
str(2) = str(1)
For J = 0 To p1.Height / 16
TextOut(p1.hdc, 2, J * 16, str(J), lstrlen(str(J)))
Next J
sendtwp(p1.hdc, 1, LedNumber, 192, 48, 4, 5, 6, 0, 1)
'发送参数("图形句柄,COM值,屏号,显示宽度,显示高度,入场方式,速度,停留时间,0,1 ")
End Function
以上VB代码编译成"nianchen.dll"
C#调用代码:
[DllImport("nianchen.dll")]
public static extern Boolean sendledA(string Sendstr,int ledNumber);
private void button1_Click(object sender, System.EventArgs e)
{
int i;
i=3;
string str="中华人民共和国";
sendledA(str,i);
}
运行时总报错:无法在 DLL nianchen.dll 中找到名为 sendledA 的入口点
请教高手这是什么原因?
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function sendtwp Lib "sourdll.dll" (ByVal SendHdc As Long, ByVal Com As Long, _
ByVal number As Long, ByVal Scr_Width As Long, ByVal Scr_Height As Long, _
ByVal inmode As Long, ByVal Speed As Long, ByVal DispTime As Long, ByVal colorswap As Long, _
ByVal rgswap As Long) As Boolean
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
Dim WithEvents p1 As VB.PictureBox
Public Function sendledA(ByVal Sendstr As String, ByVal LedNumber As Integer) As Boolean
Dim J
p1.Width = 192
p1.Height = 48
p1.FontName = "宋体"
p1.FontSize = 11
p1.ForeColor = RGB(255, 255, 0)
Dim str(3) As String
str(0) = Sendstr
str(1) = str(0)
str(2) = str(1)
For J = 0 To p1.Height / 16
TextOut(p1.hdc, 2, J * 16, str(J), lstrlen(str(J)))
Next J
sendtwp(p1.hdc, 1, LedNumber, 192, 48, 4, 5, 6, 0, 1)
'发送参数("图形句柄,COM值,屏号,显示宽度,显示高度,入场方式,速度,停留时间,0,1 ")
End Function
以上VB代码编译成"nianchen.dll"
C#调用代码:
[DllImport("nianchen.dll")]
public static extern Boolean sendledA(string Sendstr,int ledNumber);
private void button1_Click(object sender, System.EventArgs e)
{
int i;
i=3;
string str="中华人民共和国";
sendledA(str,i);
}
运行时总报错:无法在 DLL nianchen.dll 中找到名为 sendledA 的入口点
请教高手这是什么原因?