I'm quite lost and a newbie, so bear with me.
In C++ the function looks something like this:
int __stdcall helloworld(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause) {
strcpy(data, "hello world");
return 3;
}
I'm trying to replicate it in VB.NET, and I've hit a little wall with the char *data
and char *parms
part.
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
This results in output of "h"
, so I tried data()
, which results in gibberish. I then read somewhere that C/C++ char equivalent in VB.NET is byte, so I tried data() As Byte
and data = System.Text.Encoding.Default.GetBytes("hello world")
, which resulted in gibberish again.
What the DLL receives cannot be changed, so I need to find a way for VB.NET to deal with it. My question is; how do I do it in VB.NET? Can it even be done?