DispatchMessage函数

DipatchMessage函数的功能是将消息派送给窗口过程。通常情况下被用来派送GetMessage函数获得的消息。

函数原型:

LRESULT DispatchMessage(      

    const MSG *lpmsg

);

参数说明:

lpmsg:指向含有消息的MSG结构的指针。

返回值:

返回值是指定窗口过程的返回值。虽然这意味着返回值依赖于消息的分派,但通常该返回值会被忽略。

注意事项:

MSG结构必须包含有效的消息值。如果参数lpmsg指向一个WM_TIMER消息,并且WM_TIMER消息的参数lParam不为NULL,则调用lParam指向的函数,而不是调用窗口过程函数。

注意,应用程序负责检索和调度输入消息到该对话框,大多数程序使用主循环来完成这一工作。然而,要让用户可以通过键盘来进行控制操作,那么该程序必须调用IsDialogMessage函数。

//原文如下:

The DispatchMessage functiondispatches a message to a window procedure. It is typically used to dispatch amessage retrieved by the GetMessage function.

Syntax

LRESULT DispatchMessage(      

    const MSG *lpmsg

);

Parameters

lpmsg

[in] Pointer to an MSGstructure that contains the message.

Return Value

Thereturn value specifies the value returned by the window procedure. Although itsmeaning depends on the message being dispatched, the return value generally isignored.

Remarks

The MSG structuremust contain valid message values. If the lpmsg parameter points to aWM_TIMER message and the lParam parameter of the WM_TIMER messageis not NULL, lParam points to a function that is called instead of thewindow procedure.

Note that the applicationis responsible for retrieving and dispatching input messages to the dialog box.Most applications use the main message loop for this. However, to permit theuser to move to and to select controls by using the keyboard, the applicationmust call IsDialogMessage. For more information, see Dialog Box KeyboardInterface.

Windows 95/98/Me: DispatchMessageWis supported by the Microsoft Layer for Unicode (MSLU). To use this, you mustadd certain files to your application, as outlined in Microsoft Layer forUnicode on Windows 95/98/Me Systems.

 

 

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值