什么是建立在C#中的wParam和lParam的一个很好的方式? (比移位运算符友好的东西?) [英] What's a nice way of building a wParam or lParam in C#? (Something friendlier than shift operators?)
本文介绍了什么是建立在C#中的wParam和lParam的一个很好的方式? (比移位运算符友好的东西?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Win32的文档说是这样的:
的wParam
低位字指定的编辑控件标识符。
的高位字指定通知消息。
什么是建筑的一个很好的方式,wParam中?
解决方案
公共静态USHORT LowWord(UINT VAL)
{
回报(USHORT)VAL;
}
公共静态USHORT HighWord(UINT VAL)
{
回报(USHORT)(VAL>> 16);
}
公共静态UINT BuildWParam(USHORT低,USHORT高)
{
回报率((UINT)高<< 16)| (UINT)低;
}
When the WIN32 docs says something like:
wParam
The low-order word specifies the edit control identifier.
The high-order word specifies the notification message.
What's a nice way of building that 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#中的wParam和lParam的一个很好的方式? (比移位运算符友好的东西?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文