According to
pinvoke.net[
^], you need a
MarshalAs
attribute on the string parameter:
[DllImport("user32.dll")]
public static extern int SendMessageW(
[InAttribute] System.IntPtr hWnd,
int Msg,
int wParam,
[MarshalAs(UnmanagedType.LPWStr)] string lParam);