WPARAM
using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
using Windows.Win32.Graphics.Gdi;
namespace Windows.Win32.Foundation
{
[DebuggerDisplay("{Value}")]
[GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
internal readonly struct WPARAM : IEquatable<WPARAM>
{
internal readonly UIntPtr Value;
public unsafe ushort HIWORD => (ushort)((long)(IntPtr)(void*)((ulong)Value >> 16) & 65535);
public short SIGNEDHIWORD => (short)HIWORD;
public ushort LOWORD => (ushort)((long)(ulong)Value & 65535);
public short SIGNEDLOWORD => (short)LOWORD;
public unsafe static implicit operator void*(WPARAM value)
{
return (void*)(ulong)value.Value;
}
public unsafe static implicit operator WPARAM(void* value)
{
return new WPARAM((UIntPtr)value);
}
public unsafe static explicit operator HWND(WPARAM value)
{
return (HWND)(IntPtr)(void*)(ulong)value.Value;
}
public unsafe static explicit operator WPARAM(HWND value)
{
return new WPARAM((UIntPtr)value.Value);
}
public unsafe static explicit operator HDC(WPARAM value)
{
return (HDC)(IntPtr)(void*)(ulong)value.Value;
}
public unsafe static explicit operator WPARAM(HDC value)
{
return new WPARAM((UIntPtr)value.Value);
}
public unsafe static explicit operator WPARAM(HFONT value)
{
return new WPARAM((UIntPtr)value.Value);
}
public static explicit operator BOOL(WPARAM value)
{
return (BOOL)(int)(ulong)value.Value;
}
public unsafe static explicit operator WPARAM(BOOL value)
{
return new WPARAM((UIntPtr)(void*)(int)value);
}
public static explicit operator int(WPARAM value)
{
return (int)(ulong)value.Value;
}
public static explicit operator uint(WPARAM value)
{
return (uint)(ulong)value.Value;
}
public unsafe static explicit operator IntPtr(WPARAM value)
{
return (IntPtr)(void*)(ulong)value.Value;
}
public unsafe static explicit operator WPARAM(int value)
{
return new WPARAM((UIntPtr)(void*)value);
}
public unsafe static explicit operator WPARAM(char value)
{
return new WPARAM((UIntPtr)(void*)(ushort)value);
}
public unsafe static explicit operator WPARAM(Color value)
{
return new WPARAM((UIntPtr)(void*)ColorTranslator.ToWin32(value));
}
public static WPARAM MAKEWPARAM(int low, int high)
{
return (UIntPtr)(uint)((ushort)((long)low & 65535) | ((ushort)((long)high & 65535) << 16));
}
internal WPARAM(UIntPtr value)
{
Value = value;
}
public static implicit operator UIntPtr(WPARAM value)
{
return value.Value;
}
public static implicit operator WPARAM(UIntPtr value)
{
return new WPARAM(value);
}
public static bool operator ==(WPARAM left, WPARAM right)
{
return left.Value == right.Value;
}
public static bool operator !=(WPARAM left, WPARAM right)
{
return !(left == right);
}
public bool Equals(WPARAM other)
{
return Value == other.Value;
}
public override bool Equals(object obj)
{
if (obj is WPARAM) {
WPARAM other = (WPARAM)obj;
return Equals(other);
}
return false;
}
public override int GetHashCode()
{
return Value.GetHashCode();
}
public override string ToString()
{
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(2, 1);
defaultInterpolatedStringHandler.AppendLiteral("0x");
defaultInterpolatedStringHandler.AppendFormatted(Value, "x");
return defaultInterpolatedStringHandler.ToStringAndClear();
}
}
}