int __stdcall SendInt() { return 123; } BSTR __stdcall SendTxt() { char *s = "This is my string\ntoto\nxxx"; return SysAllocStringByteLen(s, lstrlen(s)); }
<DllImport("test.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ Private Shared Function SendTxt() As <MarshalAs(UnmanagedType.AnsiBStr)> String End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim s As String s = SendTxt() MsgBox(s) End Sub
#ifdef _UNICODE if (_putwc_nolock(ch, f) == WEOF) #else /* _UNICODE */ if (_putc_nolock(ch, f) == EOF) // <----- #endif /* _UNICODE */
BSTR __stdcall SendTxt() { char s[500]; sprintf(s, "\n"); sprintf(s, "%sThis is my string\ntoto\nxxx", s); return SysAllocStringByteLen(s, lstrlen(s)); }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question