WEB开发网
开发学院软件开发VC think window procedure 阅读

think window procedure

 2010-06-15 20:40:13 来源:WEB开发网   
核心提示:2.4 好,总结一下,think window procedure(3),class CWnd : public CCmdTarget{...protected:virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);virtual

2.4 好,总结一下。

class CWnd : public CCmdTarget
{
  ...

protected:
  virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  ...
}
LRESULT CALLBACK
AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
  CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
  return AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam);
}
LRESULT AFXAPI
AfxCallWndProc(CWnd* pWnd, HWND hWnd, UINT nMsg,
  WPARAM wParam = 0, LPARAM lParam = 0)
{
  LRESULT lResult;
  lResult = pWnd->WindowProc(nMsg, wParam, lParam);
  return lResult;
}
LRESULT CWnd::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
  LRESULT lResult = 0;
  if (!OnWndMsg(message, wParam, lParam, & lResult))
    lResult = DefWindowProc(message, wParam, lParam);
  return lResult;
}
BOOL CWnd::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
  if (message == WM_COMMAND)
    OnCommand(wParam, lParam);
  else if (message == WM_NOTIFY)
    OnNotify(wParam, lParam, & lResult);
  else
    ...// msg map related
}

LRESULT CWnd::DefWindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)
{
  if (m_pfnSuper != NULL)
    return ::CallWindowProc(m_pfnSuper, m_hWnd, nMsg, wParam, lParam);
}

上一页  1 2 3 

Tags:think window procedure

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接