SendMessage(WM_VSCROLL,MAKEWPARAM(bUp?SB_LINEUP:SB_LINEDOWN,0),0);
我刚学MFC没多久,对这段代码有些不解:1.MAKEWPARAM宏怎么用?在本段代码里起什么作用?
2.貌似SendMessage将激活消息映射WM_VSCROLL的响应函数,若是,那么SendMessage将什么信息传递给那个响应函数?
在MSDN里也查过,但是仍然不太理解,请高手赐教,非常感谢!
我刚学MFC没多久,对这段代码有些不解:1.MAKEWPARAM宏怎么用?在本段代码里起什么作用?
2.貌似SendMessage将激活消息映射WM_VSCROLL的响应函数,若是,那么SendMessage将什么信息传递给那个响应函数?
在MSDN里也查过,但是仍然不太理解,请高手赐教,非常感谢!
解决方案 »
- CoCreateInstanceAsAdmin用来提升用户的UAC权限,但不知道怎么使用?
- 请教数据分析问题
- 不知道该向什么方向发展了?大家帮帮忙吧
- 求IntelliCAD源码
- 在程序中使用windows中的环境变量,是不是一个不建议的思路呀?
- MFC 中如何实现文件与播放器的关联
- ip问题!
- winsock的int send(SOCKET s,const char FAR *buf,int len,int flags)的返回值可能小于len,是什么情况下会出现这样的情况?
- visual c++5.0上编的程序能与6.0兼容吗?
- 用 API 编个WORD文档阅读器
- 怎么样将char[]转为CString(char内容不是文本)
- 求关于hdlc的crc校验的源代码!!!
你应该看看Windows编程等书籍。
SB_LINEUP, SB_LINEDOWN 将滚动框调整一个单位的位置
LRESULT SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );Return ValueThe result of the message processing; its value depends on the message sent.ParametersmessageSpecifies the message to be sent.wParamSpecifies additional message-dependent information.lParamSpecifies additional message-dependent information.ResSends the specified message to this window. The SendMessage member function calls the window procedure directly and does not return until that window procedure has processed the message. This is in contrast to the PostMessage member function, which places the message into the window’s message queue and returns immediately.
MAKEWPARAM宏的说明:
The MAKEWPARAM macro creates a value for use as a wParam parameter in a message. The macro concatenates the specified values. WPARAM MAKEWPARAM(
WORD wLow,
WORD wHigh
);
Parameters
wLow
Specifies the low-order word of the new value.
wHigh
Specifies the high-order word of the new value.
Return Values
The return value is a WPARAM value.
建议好好利用MSDN,学会利用MSDN,强化英语
就是发消息之后直接响应WM_VSCROLL,简单的说就是调用OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
#define MAKEWPARAM(l, h) (WPARAM)MAKELONG(l, h)//每条消息的高字和低字都有不同的定义,使用之前应查看MSDN。------------------------------------------------------------------------WM_VSCROLL
nScrollCode = (int) LOWORD(wParam); // scroll bar value
nPos = (short int) HIWORD(wParam); // scroll box position
hwndScrollBar = (HWND) lParam; // handle to scroll bar nPos
Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used. //高字(即:nPos),只有在 SB_THUMBPOSITION 或 SB_THUMBTRACK 才需要使用,所以如果是SB_LINEUP 或 SB_LINEDOWN 就不用设置了。