VC:
LPSTR _stdcall WINAPI testb(char *a);LPSTR _stdcall WINAPI testb(char *a)
{
a = "Hello";
return a;
}VB:
Public Declare Function testb Lib "D:\MACAddressTool\Release\MACAddressTool.dll" (ByVal strS As String) As String
Dim aa As String
Dim bb As String
bb = testb(aa)执行结束,aa,bb的值都为空,请帮忙看看是怎么回事,哪里出了问题了,谢谢啦。
LPSTR _stdcall WINAPI testb(char *a);LPSTR _stdcall WINAPI testb(char *a)
{
a = "Hello";
return a;
}VB:
Public Declare Function testb Lib "D:\MACAddressTool\Release\MACAddressTool.dll" (ByVal strS As String) As String
Dim aa As String
Dim bb As String
bb = testb(aa)执行结束,aa,bb的值都为空,请帮忙看看是怎么回事,哪里出了问题了,谢谢啦。
免得转来转去
{
return SysAllocStringByteLen((LPCTSTR)a,sizeof(a));
}BOOL WINAPI DllMain(
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpvReserved // reserved
)
{
return TRUE;
}VB调用Private Declare Function TestStringForVB Lib "你的DLL文件路径\DLL.dll" (ByVal a As String) As StringPrivate Sub Form_Load() Dim a As String
a = "你好"
Dim b As String
b = TestStringForVB(a)
MsgBox b
End Sub
dim data as string
dim i ,j as interge
j = data.Length For i = 0 To j
bytes(i) = Convert.ToByte(data.Substring(i * 2, 2), 16)
Next i