首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

(VB API)关于SendMessage中参数wMsg的常量怎么取

2012-01-21 
(VB API)关于SendMessage中参数wMsg的常量如何取模块中代码:DeclareFunctionSendMessageLibuser32 Alias

(VB API)关于SendMessage中参数wMsg的常量如何取
模块中代码:

Declare   Function   SendMessage   Lib   "user32 "   Alias   "SendMessageA "   (ByVal   hwnd   As   Long,   ByVal   wMsg   As   Long,   ByVal   wParam   As   Long,lParam   As   Any)   As   Long
Public   Const   EM_GETLINECOUNT=&HBA
Public   Const   EM_GETLINE=&HC4

Form1的代码:

Private   Sub   Command1_Click()
        Dim   str(256)   As   Byte
        str(1)=1   '最大允许存放256个字符
        '获取总行数,结果显示在文本框txtLineCount中
        txtlineCount=SendMessage(Text1.hwnd,EM_GETLINECOUNT,0,0)
        '获取第3行的数据放在str中,转换为字符串后显示在文本框txtString中
        SendMessage   Text1.hwnd,EM_GETLINE,2,str(0)
        txtString=   StrConv(str,vbUnicode)
End   Sub

其中SendMessage向TextBox1.hWnd发送了消息EM_GETLINECOUNT和EM_GETLINE,其在常量的指定中分别定义为&HBA和&HC4,这些常量值代表着一定的控件内部的信息指令,我想知道这个两个常量的值是从获得?我又如何去知道这个常量值是做什么的呢?这些常量应该是对应每一个控件的,那么又怎么去查找这个常量值呢?


[解决办法]
//我想知道这个两个常量的值是从获得?

//

这是老比定义的

//我又如何去知道这个常量值是做什么的呢?

这还是老比定义的

//这些常量应该是对应每一个控件的,那么又怎么去查找这个常量值呢?

这是楼上说的.....
[解决办法]
你在网上找找“windows消息大全”之类的东西来看看。。。有个了解再到msdn去找。
[解决办法]
Public Enum VBWin_Msg
WM_NULL = &H0
WM_CREATE = &H1
WM_DESTROY = &H2
WM_MOVE = &H3
WM_SIZE = &H5
WM_ACTIVATE = &H6
WM_SETFOCUS = &H7
WM_KILLFOCUS = &H8
WM_ENABLE = &HA
WM_SETREDRAW = &HB
WM_SETTEXT = &HC
WM_GETTEXT = &HD
WM_GETTEXTLENGTH = &HE
WM_PAINT = &HF
WM_CLOSE = &H10
WM_QUERYENDSESSION = &H11
WM_QUIT = &H12
WM_QUERYOPEN = &H13
WM_ERASEBKGND = &H14
WM_SYSCOLORCHANGE = &H15
WM_ENDSESSION = &H16
WM_SHOWWINDOW = &H18
WM_WININICHANGE = &H1A
WM_DEVMODECHANGE = &H1B
WM_ACTIVATEAPP = &H1C
WM_FONTCHANGE = &H1D
WM_TIMECHANGE = &H1E
WM_CANCELMODE = &H1F
WM_SETCURSOR = &H20
WM_MOUSEACTIVATE = &H21
WM_CHILDACTIVATE = &H22
WM_QUEUESYNC = &H23
WM_GETMINMAXINFO = &H24
'begin_r_winuser
WM_PAINTICON = &H26
WM_ICONERASEBKGND = &H27
WM_NEXTDLGCTL = &H28
WM_SPOOLERSTATUS = &H2A
WM_DRAWITEM = &H2B
WM_MEASUREITEM = &H2C
WM_DELETEITEM = &H2D
WM_VKEYTOITEM = &H2E
WM_CHARTOITEM = &H2F
WM_SETFONT = &H30
WM_GETFONT = &H31
WM_SETHOTKEY = &H32
WM_GETHOTKEY = &H33
WM_QUERYDRAGICON = &H37
WM_COMPAREITEM = &H39
WM_COMPACTING = &H41
WM_COMMNOTIFY = &H44 '/* no longer suported */
WM_WINDOWPOSCHANGING = &H46
WM_WINDOWPOSCHANGED = &H47
WM_POWER = &H48
WM_COPYDATA = &H4A
WM_CANCELJOURNAL = &H4B
'end_r_winuser
'lParam of WM_COPYDATA message points to...
'begin_r_winuser


' '#if(WINVER > = 0x0400)
WM_NOTIFY = &H4E
WM_INPUTLANGCHANGEREQUEST = &H50
WM_INPUTLANGCHANGE = &H51
WM_TCARD = &H52
WM_HELP = &H53
WM_USERCHANGED = &H54
WM_NOTIFYFORMAT = &H55

WM_CONTEXTMENU = &H7B
WM_STYLECHANGING = &H7C
WM_STYLECHANGED = &H7D
WM_DISPLAYCHANGE = &H7E
WM_GETICON = &H7F
WM_SETICON = &H80
' '#endif /* WINVER > = 0x0400 */
WM_NCCREATE = &H81
WM_NCDESTROY = &H82
WM_NCCALCSIZE = &H83
WM_NCHITTEST = &H84
WM_NCPAINT = &H85
WM_NCACTIVATE = &H86
WM_GETDLGCODE = &H87
WM_SYNCPAINT = &H88
WM_NCMOUSEMOVE = &HA0
WM_NCLBUTTONDOWN = &HA1
WM_NCLBUTTONUP = &HA2
WM_NCLBUTTONDBLCLK = &HA3
WM_NCRBUTTONDOWN = &HA4
WM_NCRBUTTONUP = &HA5
WM_NCRBUTTONDBLCLK = &HA6
WM_NCMBUTTONDOWN = &HA7
WM_NCMBUTTONUP = &HA8
WM_NCMBUTTONDBLCLK = &HA9

WM_KEYFIRST = &H100
WM_KEYDOWN = &H100
WM_KEYUP = &H101
WM_CHAR = &H102
WM_DEADCHAR = &H103
WM_SYSKEYDOWN = &H104
WM_SYSKEYUP = &H105
WM_SYSCHAR = &H106
WM_SYSDEADCHAR = &H107
WM_KEYLAST = &H108

' '#if(WINVER > = 0x0400)
WM_IME_STARTCOMPOSITION = &H10D
WM_IME_ENDCOMPOSITION = &H10E
WM_IME_COMPOSITION = &H10F
WM_IME_KEYLAST = &H10F
' '#endif /* WINVER > = 0x0400 */

WM_INITDIALOG = &H110
WM_COMMAND = &H111
WM_SYSCOMMAND = &H112
WM_TIMER = &H113
WM_HSCROLL = &H114
WM_VSCROLL = &H115
WM_INITMENU = &H116
WM_INITMENUPOPUP = &H117
WM_MENUSELECT = &H11F
WM_MENUCHAR = &H120
WM_ENTERIDLE = &H121
'#if(WINVER > = 0x0500)
WM_MENURBUTTONUP = &H122
WM_MENUDRAG = &H123
WM_MENUGETOBJECT = &H124
WM_UNINITMENUPOPUP = &H125
WM_MENUCOMMAND = &H126
'#endif /* WINVER > = 0x0500 */


WM_CTLCOLORMSGBOX = &H132
WM_CTLCOLOREDIT = &H133
WM_CTLCOLORLISTBOX = &H134
WM_CTLCOLORBTN = &H135
WM_CTLCOLORDLG = &H136
WM_CTLCOLORSCROLLBAR = &H137
WM_CTLCOLORSTATIC = &H138


WM_MOUSEFIRST = &H200
WM_MOUSEMOVE = &H200
WM_LBUTTONDOWN = &H201
WM_LBUTTONUP = &H202
WM_LBUTTONDBLCLK = &H203
WM_RBUTTONDOWN = &H204
WM_RBUTTONUP = &H205
WM_RBUTTONDBLCLK = &H206
WM_MBUTTONDOWN = &H207
WM_MBUTTONUP = &H208
WM_MBUTTONDBLCLK = &H209

'#if (_WIN32_WINNT > = 0x0400) || (_WIN32_WINDOWS > 0x0400)
WM_MOUSEWHEEL = &H20A
WM_MOUSELAST = &H20A
'#Else
' WM_MOUSELAST = &H209
'#endif /* if (_WIN32_WINNT < 0x0400) */

'#if(_WIN32_WINNT > = 0x0400)
'#define WHEEL_DELTA 120 /* Value for rolling one detent */
'#endif /* _WIN32_WINNT > = 0x0400 */
'#if(_WIN32_WINNT > = 0x0400)
'#define WHEEL_PAGESCROLL (UINT_MAX) /* Scroll one page */
'#endif /* _WIN32_WINNT > = 0x0400 */
WM_PARENTNOTIFY = &H210
WM_ENTERMENULOOP = &H211
WM_EXITMENULOOP = &H212
'#if(WINVER > = 0x0400)


WM_NEXTMENU = &H213
'// end_r_winuser
WM_DEVICECHANGE = &H219
'#endif /* WINVER > = 0x0400 */
WM_MDICREATE = &H220
WM_MDIDESTROY = &H221
WM_MDIACTIVATE = &H222
WM_MDIRESTORE = &H223
WM_MDINEXT = &H224
WM_MDIMAXIMIZE = &H225
WM_MDITILE = &H226
WM_MDICASCADE = &H227
WM_MDIICONARRANGE = &H228
WM_MDIGETACTIVE = &H229

WM_MDISETMENU = &H230
WM_ENTERSIZEMOVE = &H231
WM_EXITSIZEMOVE = &H232
WM_DROPFILES = &H233
WM_MDIREFRESHMENU = &H234
'#if(WINVER > = 0x0400)
WM_IME_SETCONTEXT = &H281
WM_IME_NOTIFY = &H282
WM_IME_CONTROL = &H283
WM_IME_COMPOSITIONFULL = &H284
WM_IME_SELECT = &H285
WM_IME_CHAR = &H286
'#endif /* WINVER > = 0x0400 */
'#if(WINVER > = 0x0500)
WM_IME_REQUEST = &H288
'#endif /* WINVER > = 0x0500 */
'#if(WINVER > = 0x0400)
WM_IME_KEYDOWN = &H290
WM_IME_KEYUP = &H291
'#endif /* WINVER > = 0x0400 */


'#if(_WIN32_WINNT > = 0x0400)
WM_MOUSEHOVER = &H2A1
WM_MOUSELEAVE = &H2A3
'#endif /* _WIN32_WINNT > = 0x0400 */

WM_CUT = &H300
WM_COPY = &H301
WM_PASTE = &H302
WM_CLEAR = &H303
WM_UNDO = &H304
WM_RENDERFORMAT = &H305
WM_RENDERALLFORMATS = &H306
WM_DESTROYCLIPBOARD = &H307
WM_DRAWCLIPBOARD = &H308
WM_PAINTCLIPBOARD = &H309
WM_VSCROLLCLIPBOARD = &H30A
WM_SIZECLIPBOARD = &H30B
WM_ASKCBFORMATNAME = &H30C
WM_CHANGECBCHAIN = &H30D
WM_HSCROLLCLIPBOARD = &H30E
WM_QUERYNEWPALETTE = &H30F
WM_PALETTEISCHANGING = &H310
WM_PALETTECHANGED = &H311
WM_HOTKEY = &H312
'#if(WINVER > = 0x0400)
WM_PRINT = &H317
WM_PRINTCLIENT = &H318
WM_HANDHELDFIRST = &H358
WM_HANDHELDLAST = &H35F

WM_AFXFIRST = &H360
WM_AFXLAST = &H37F
'#endif /* WINVER > = 0x0400 */

WM_PENWINFIRST = &H380
WM_PENWINLAST = &H38F
WM_USER = &H400
Public Enum eWM_Msg
WM_NULL = &H0
WM_CREATE = &H1
WM_DESTROY = &H2
WM_MOVE = &H3
WM_SIZE = &H5
WM_ACTIVATE = &H6
WM_SETFOCUS = &H7
WM_KILLFOCUS = &H8
WM_USER = &H400
End Enum

热点排行