复婚怎么撤销离婚协议:VC++ 中CWnd::SendMessage( )函数的作用是什么?

来源:百度文库 编辑:中科新闻网 时间:2024/04/19 13:40:46
VC++ 中CWnd::SendMessage( )函数的作用是什么?

SendMessage(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
这个函数的第一个参数是你要发送到的窗口的句柄,第二个参数是消息的号码,如果是系统自定义消息的话可以直接用,如果是你自定义消息的话需要自己指定一个值,可以在头文件里用宏进行定义,如:
#define WM_MY_MESSAGE (WM_USER+1)
WM_USER 是系统预留给用户的自定义消息的最小值,所有大于这个值的消息都是自定义消息.你也可以用常量代替:
const UINT WM_MY_MESSAGE = WM_USER+1
后面的两个参数就是windows消息的两个32位参数.

楼主要学会查msdn哦
CWnd::SendMessage
LRESULT SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );

Return Value

The result of the message processing; its value depends on the message sent.

Parameters

message

Specifies the message to be sent.

wParam

Specifies additional message-dependent information.

lParam

Specifies additional message-dependent information.

Remarks

Sends 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.

sendmessage()直接调用窗口过程,直到消息队列中所有在他前面的消息被处理完才返回.