c# - 在 C# 中构建 wParam 或 lParam 的好方法是什么? (比轮类运算符(operator)更友好的东西吗?)

标签 c# winapi

当 WIN32 文档说这样的话:

wParam
    The low-order word specifies the edit control identifier.
    The high-order word specifies the notification message. 

构建 wParam 的好方法是什么?

最佳答案

public static ushort LowWord(uint val)
{
    return (ushort)val;
}

public static ushort HighWord(uint val)
{
   return (ushort)(val >> 16);
}

public static uint BuildWParam(ushort low, ushort high)
{
    return ((uint)high << 16) | (uint)low;
}

关于c# - 在 C# 中构建 wParam 或 lParam 的好方法是什么? (比轮类运算符(operator)更友好的东西吗?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/202330/

相关文章:

c# - 如何在 Visual Studio Code 上将外部程序集 (.dll) 添加到 .NET Core 2.0

c# - 在 Windows 7 上使用 .NET 以编程方式创建/销毁网桥

c++ - 使用 WSAAddressToString 时的问题

c++ - 从 DLLMain 调用托管代码

c# - C# 的排序集如何与自定义对象一起使用?

c# - 在 MvvmCross 中将单个 View/ViewModel/Xaml 链接到多个 Json 资源文件的最佳方式

c# - 使用 Task.StartNew 方法时如何保证创建新线程

c++ - Windows API SendMessage + WM_SETTEXT 结果崩溃

windows - HttpAddFragmentToCache 和操作系统错误 50

c# - ASP Webforms 验证控件不工作