Last active
January 7, 2024 01:23
-
-
Save xv/5705e58aba998b2ef5ec8fcc5e2c2be8 to your computer and use it in GitHub Desktop.
Common Win32 API macros.
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
public static byte LOBYTE(ushort a) => | |
(byte)(a & 0xFF); | |
public static byte HIBYTE(ushort a) => | |
(byte)((a >> 8) & 0xFF); | |
public static ushort HIWORD(uint a) => | |
(ushort)((a >> 16) & 0xFFFF); | |
public static ushort LOWORD(uint a) => | |
(ushort)(a & 0xFFFF); | |
public static ushort MAKEWORD(byte a, byte b) => | |
(ushort)((a & 0xFF) | (b << 8)); | |
public static int MAKELONG(ushort a, ushort b) => | |
(a & 0xFFFF) | ((b & 0xFFFF) << 16); | |
public static UIntPtr MAKEWPARAM(ushort a, ushort b) => | |
new UIntPtr((uint)MAKELONG(a, b)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment