SendMessage函数的消息编号的说明? [英] Explanation of SendMessage message numbers?
问题描述
我已经成功地使用Windows的SendMessage函数方法来帮助我做各种事情在我的文本编辑器,但每次我只是复制和粘贴代码别人的建议,我真的不知道这意味着什么。总是有一个参数隐蔽消息号。我怎么知道这些代码编号的意思是让我能真正了解发生什么事,(希望)多一点自给自足的未来?谢谢
最近的例子:
使用System.Runtime.InteropServices ;
函数[DllImport(user32.dll中)]
静态外部INT SendMessage函数(IntPtr的的HWND,UINT WMSG,UIntPtr的wParam,lParam的的IntPtr);
的SendMessage(myRichTextBox.Handle,(UINT)0x00B6,(UIntPtr)0,(IntPtr的)( - 1));
这是Windows的消息代码。
它们在头文件中定义,一般可翻译为一个包含某种形式与不同的语言。
例如:
WM_MOUSEMOVE =安培; H200
MK_CONTROL =安培; H8
MK_LBUTTON =安培; H1
MK_MBUTTON =安培; H10
MK_RBUTTON =安培; H2
MK_SHIFT =安培; H4
MK_XBUTTON1 =安培; H20
MK_XBUTTON2 =安培; H40
看的 http://msdn.microsoft.com/en-us/library/ms644927(VS.85)的.aspx# windows_messages 。
I've successfully used the Windows SendMessage method to help me do various things in my text editor, but each time I am just copying and pasting code suggested by others, and I don't really know what it means. There is always a cryptic message number that is a parameter. How do I know what these code numbers mean so that I can actually understand what is happening and (hopefully) be a little more self-sufficient in the future? Thanks.
Recent example:
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
static extern int SendMessage(IntPtr hWnd, uint wMsg,UIntPtr wParam, IntPtr lParam);
SendMessage(myRichTextBox.Handle, (uint)0x00B6, (UIntPtr)0, (IntPtr)(-1));
This is the windows message code.
They are defined in the header files, and generally available translated as an include of some sort with different languages.
example:
WM_MOUSEMOVE = &H200
MK_CONTROL = &H8
MK_LBUTTON = &H1
MK_MBUTTON = &H10
MK_RBUTTON = &H2
MK_SHIFT = &H4
MK_XBUTTON1 = &H20
MK_XBUTTON2 = &H40
see http://msdn.microsoft.com/en-us/library/ms644927(VS.85).aspx#windows_messages.
这篇关于SendMessage函数的消息编号的说明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!