zoukankan      html  css  js  c++  java
  • OnCmdMsg() VS PostMessage()

    In the place you plan to post message:

    a. If you are sure the WM_Command can be handled by view/document, you can directly call View::OnCmdMsg() or Doc::OnCmdMsg() to post the message;

    b. If you don't know where in the command routing way will handle the command, you have to use ::PostMessage or CWnd::PostMessage() which is inside calling ::PostMessage(). See below source code:

    (c:"Program Files"Microsoft Visual Studio 9.0"VC"atlmfc"include"afxwin2.inl)

    _AFXWIN_INLINE BOOL CWnd::PostMessage(UINT message, WPARAM wParam, LPARAM lParam)

    { ASSERT(::IsWindow(m_hWnd)); return ::PostMessage(m_hWnd, message, wParam, lParam); }

    PostMessage 和SendMessage的区别主要在于是否等待其他程序消息处理。PostMessage只是把消息放入队列,不管其他程序是否处理都返回,然后继续执 行;而SendMessage必须等待其他程序处理消息后才返回,继续执行。这两个函数的返回值也不同,PostMessage的返回值表示 PostMessage函数执行是否正确,而SendMessage的返回值表示其他程序处理消息后的返回值。

  • 相关阅读:
    poj2942 点-双联通+二分图染色
    poj1523割顶-点双联通
    poj3694 边-双连通分量+lca
    poj3177边-双连通分量
    poj3352 边-双联通分量
    Codeforces Round #377 (Div. 2) F
    Educational Codeforces Round 30D. Merge Sort
    洛谷p3369 treap
    hdu3572线性欧拉筛
    HYSBZ
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1486241.html
Copyright © 2011-2022 走看看