Skip to content

Instantly share code, notes, and snippets.

@toptensoftware
Created November 2, 2016 08:52
Show Gist options
  • Save toptensoftware/9ce3b2f543ac095ea74cdc2cea22aaa9 to your computer and use it in GitHub Desktop.
Save toptensoftware/9ce3b2f543ac095ea74cdc2cea22aaa9 to your computer and use it in GitHub Desktop.
[MappedType]
public struct HDC
{
// Win32 handle value
public IntPtr value;
// The map
public static HandleMap Map = new HandleMap();
// Methods required by MappedType's
public static HDC To32(ushort hDC) { return new HDC() { value = Map.To32(hDC) }; }
public static ushort To16(HDC hDC) { return Map.To16(hDC.value); }
// Other helpers
public static implicit operator HDC(IntPtr value) { return new HDC() { value = value }; }
public static HDC Null = IntPtr.Zero;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment