LPARAM
using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
namespace Windows.Win32.Foundation
{
[DebuggerDisplay("{Value}")]
[GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
internal readonly struct LPARAM : IEquatable<LPARAM>
{
internal readonly IntPtr Value;
public unsafe ushort HIWORD => (ushort)((long)(IntPtr)(void*)((ulong)(long)Value >> 16) & 65535);
public short SIGNEDHIWORD => (short)HIWORD;
public ushort LOWORD => (ushort)((long)Value & 65535);
public short SIGNEDLOWORD => (short)LOWORD;
public unsafe static implicit operator void*(LPARAM value)
{
return (void*)(long)value.Value;
}
public unsafe static implicit operator LPARAM(void* value)
{
return new LPARAM((IntPtr)value);
}
public static explicit operator LPARAM(BOOL value)
{
return new LPARAM((IntPtr)(int)value);
}
public static implicit operator LPARAM(int value)
{
return new LPARAM((IntPtr)value);
}
public static explicit operator int(LPARAM value)
{
return (int)(long)value.Value;
}
public static explicit operator uint(LPARAM value)
{
return (uint)(long)value.Value;
}
public unsafe static explicit operator UIntPtr(LPARAM value)
{
return (UIntPtr)(void*)(long)value.Value;
}
public unsafe static explicit operator LPARAM(uint value)
{
return new LPARAM((IntPtr)(void*)value);
}
public static explicit operator HWND(LPARAM value)
{
return (HWND)value.Value;
}
public unsafe static explicit operator LPARAM(HWND value)
{
return value.Value;
}
public static explicit operator LPARAM(Color value)
{
return ColorTranslator.ToWin32(value);
}
public static explicit operator Point(LPARAM value)
{
return new Point(value.SIGNEDLOWORD, value.SIGNEDHIWORD);
}
public static explicit operator LPARAM(Point value)
{
return MAKELPARAM(value.X, value.Y);
}
public static LPARAM MAKELPARAM(int low, int high)
{
return (LPARAM)(uint)((ushort)((long)low & 65535) | ((ushort)((long)high & 65535) << 16));
}
internal LPARAM(IntPtr value)
{
Value = value;
}
public static implicit operator IntPtr(LPARAM value)
{
return value.Value;
}
public static implicit operator LPARAM(IntPtr value)
{
return new LPARAM(value);
}
public static bool operator ==(LPARAM left, LPARAM right)
{
return left.Value == right.Value;
}
public static bool operator !=(LPARAM left, LPARAM right)
{
return !(left == right);
}
public bool Equals(LPARAM other)
{
return Value == other.Value;
}
public override bool Equals(object obj)
{
if (obj is LPARAM) {
LPARAM other = (LPARAM)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();
}
}
}