-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Windows.Win32.Foundation; | ||
using Windows.Win32.System.WinRT; | ||
using static Windows.Win32.PInvoke; | ||
|
||
namespace Shmuelie.Interop.Windows; | ||
|
||
internal static class HSTRING_ | ||
{ | ||
#if !NETSTANDARD | ||
[System.Runtime.Versioning.SupportedOSPlatform("windows8.0")] | ||
#endif | ||
public unsafe static string AsString(this HSTRING @this) | ||
{ | ||
if (@this.IsNull) | ||
{ | ||
return string.Empty; | ||
} | ||
|
||
uint characterCount; | ||
PCWSTR characters = WindowsGetStringRawBuffer(@this, &characterCount); | ||
|
||
return characters.ToString(); | ||
} | ||
} |