我很迷茫,是个新手,所以请耐心等待。
在 C++ 中,函数看起来像这样:
int __stdcall helloworld(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause) {
strcpy(data, "hello world");
return 3;
}
我正在尝试在 VB.NET 中复制它,但我已经用char *dataandchar *parms部分碰了壁。
Public Shared Function helloworld(ByVal mWnd As IntPtr, ByVal aWnd As IntPtr, ByRef data As Char, ByRef parms As Char, ByVal show As Boolean, ByVal nopause As Boolean) As Integer
data = "hello world"
Return 3
End Function
这导致输出"h",所以我尝试了data(),这导致乱码。然后我在某处读到 VB.NET 中的 C/C++ char 等效项是字节,所以我尝试了data() As Byteand data = System.Text.Encoding.Default.GetBytes("hello world"),这又导致了乱码。
DLL 接收的内容无法更改,因此我需要找到一种方法让 VB.NET 处理它。我的问题是;我如何在 VB.NET 中做到这一点?甚至可以做到吗?