BOOL PostMessage(
  HWND hWnd,      // handle to destination window
  UINT Msg,       // message
  WPARAM wParam,  // first message parameter
  LPARAM lParam   // second message parameter
);

解决方案 »

  1.   

    hWnd参数是你要发送给它消息的窗口句柄,你把那个窗口句柄传进来阿hWnd 
    [in] Handle to the window whose window procedure is to receive the message. The following values have special meanings. Value Meaning 
    HWND_BROADCAST The message is posted to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows. The message is not posted to child windows. 
    NULL The function behaves like a call to PostThreadMessage with the dwThreadId parameter set to the identifier of the current thread. 
      

  2.   

    第一个是窗口句柄 GetParent()->m_hWnd
    可以把#define xxx_xxx WM_USER+112放在AFXSTD.H里
      

  3.   

    不行,第一个参数用了GetParent()->m_hWnd,但还是传不进去!
      

  4.   

    //MyDialog.h 
    #define xxx_xxx WM_USER+112
    class CMyDialog
    {
    .......
        afx_msg void ReceiveMessage(WPARAM wParam,LPARAM);
    ......
    }//MyDialog.cpp
    ...
    ON_MESSAGE(xxx_xxx,ReceiveMessage)...
    void CMyDialog::ReceiveMessage(WPARAM wParam,LPARAM)
    {
    ...
    }//下面在某个函数中
    //pMyDialog 指向你的某个CMyDilog 对象 

    ::PostMessage(pMyDialog->GetSafeHWnd(),0,0);
    ......
    不可以用ClassWirard 的,只能用手工
      

  5.   

    这个问题可以这样做
    AfxGetMainWnd()->PostMessage(xxx_xxx,0,0);或是取得当前类的HWND,
    ::PostMessage(this->m_hWnd,xxx_xxx,0,0);
      

  6.   

    多谢各位的回复和热心帮助,但可能是我的问题不够简单明了,接下来重新整理一下:对话框类CMyDialog,视图类CMyView
        //MyView.h
        ……
        CMyDialog MyDialog;
        ……
        
        //MyView.cpp
        ……
        ……MyDialog.DoModal()……
        ……    我想实现的是:对话框的某个按钮按下,传一个消息给视图,以期让视图实现某些操作。
      

  7.   

    现在困扰我的是PostMessage的第一个参数,不知道在对话框中怎么得到激活它的视图指针。