//VB调用
Declare Sub A Lib "project2.dll" (ByRef s1 As String)
%如果不行用 Declare Sub A Lib "project2.dll" (ByVal s1 As String)试试
Private Sub CommandButton1_Click()
Dim s As String
s = String(255, vbNullChar)
A(s)
text2.text = s
End Sub
//不很规范,但一直在运行
'抄月表码(定时)(dwCTUID--终端号,lpstrRecvData--返回字符型数组,nRecvLen--返回字符个数) lpstrRecvData 要预先分配空间
Public Declare Function RecvMonCode Lib "RecvMeter" (ByVal dwCTUID As Long, lpstrRecvData As Byte, ByRef nRecvLen As Long) As Long
function RecvMonCode(dwCTUID: DWORD;
var lpstrRecvData;
var nRecvLen: integer): integer;
stdcall;
呵呵呵,改改你的DLL函数定义
Private Declare Function GetHarddisk_ID Lib _
"HardDiskSN.dll" (ByVal lpBuffer As String) As Long
Dim Harddisk_ID As String, num As Long
Harddisk_ID = Space(255)
num=GetHarddisk_ID(Harddisk_ID)
MsgBox "硬盘的ID号是:" + Harddisk_ID