diff --git a/PInvoke/User32/WinUser.System.cs b/PInvoke/User32/WinUser.System.cs index 2765e40d..1897108c 100644 --- a/PInvoke/User32/WinUser.System.cs +++ b/PInvoke/User32/WinUser.System.cs @@ -3722,8 +3722,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/desktop/dlgbox/mb-getstring LPCWSTR WINAPI MB_GetString( UINT wBtn ); [DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)] [PInvokeData("", MSDNShortId = "D2AF238D-F5A8-477D-BF47-0F5D4D68B27E")] - [return: MarshalAs(UnmanagedType.LPWStr)] - public static extern string MB_GetString(uint wBtn); + public static extern StrPtrUni MB_GetString(uint wBtn); /// /// Plays a waveform sound. The waveform sound for each sound type is identified by an entry in the registry. diff --git a/UnitTests/PInvoke/User32/User32Tests.cs b/UnitTests/PInvoke/User32/User32Tests.cs index 973728a7..4f2322fc 100644 --- a/UnitTests/PInvoke/User32/User32Tests.cs +++ b/UnitTests/PInvoke/User32/User32Tests.cs @@ -71,6 +71,13 @@ namespace Vanara.PInvoke.Tests throw new NotImplementedException(); } + [Test()] + public void MB_GetStringTest() + { + Assert.NotNull((string)MB_GetString(1)); + TestContext.WriteLine((string)MB_GetString(1)); + } + [Test()] public void RealGetWindowClassTest() {