能不能给个例子,多谢!

解决方案 »

  1.   

    还是自己解决了,动态创建Realplayer类就可以了如要消息映射,可先添加控件,添加消息映射,再删除界面上的控件注意:动态创建时的ID = (你先前添加的控件ID),父窗口为接受消息的窗口
      

  2.   

    高手你好!我看到你关于RealPlayer控件的发言:
    “用CFormView放置Realplayer控件,添加了成员变量后,退出时为什么会出错??”  后来,你说“还是自己解决了,动态创建Realplayer类就可以了。如要消息映射,可先添加控件,添加消息映射,再删除界面上的控件”。
    现在我也碰到这个问题了,插入RealPlayer控件后再打开对话框资源会出错,我就按您说的动态创建了RealPlayer控件。但是,我按您说的方法在对话框资源上添加控件进行消息映射时,却会出错,无法进行消息映射EVENTSINK_MAP。所以,我想请您帮忙,把RealPlayerG2控件的“所有”消息映射代码,复制一份给我好吗?就是
    BEGIN_EVENTSINK_MAP()和END_EVENTSINK_MAP()之间的内容,加上消息映射函数的声明。
    谢谢!
      

  3.   

    Jimware:  这有消息映射代码给你,不过我想你最好建另一个工程加入Real映射来得到这些代码,因为你可能还会需要其他消息映射,如果你不能进行消息映射,我建议你重装Real控件,Real控件有点怪,在VB测试,它工作得很好,在VC里就非要用动态创建,我也搞不懂BEGIN_EVENTSINK_MAP(CHotSpotView, CFormView)
    //{{AFX_EVENTSINK_MAP(CHotSpotView)
    ON_EVENT(CHotSpotView, IDC_PLAY, -600 /* Click */, OnClickPlay, VTS_NONE)
    ON_EVENT(CHotSpotView, IDC_PAUSE, -600 /* Click */, OnClickPause, VTS_NONE)
    ON_EVENT(CHotSpotView, IDC_STOP, -600 /* Click */, OnClickStop, VTS_NONE)
    ON_EVENT(CHotSpotView, IDC_BACK, -600 /* Click */, OnClickBack, VTS_NONE)
    ON_EVENT(CHotSpotView, IDC_FORWARD, -600 /* Click */, OnClickForward, VTS_NONE)
    ON_EVENT(CHotSpotView, IDC_REALPLAYER1, 1013 /* OnPlayStateChange */, OnOnPlayStateChangeRealplayer1, VTS_I4)
    ON_EVENT(CHotSpotView, IDC_REALPLAYER1, 1005 /* OnPositionChange */, OnOnPositionChangeRealplayer1, VTS_I4 VTS_I4)
    ON_EVENT(CHotSpotView, IDC_REALPLAYER1, 1042 /* OnStateChange */, OnOnStateChangeRealplayer1, VTS_I4 VTS_I4)
    ON_EVENT(CHotSpotView, IDC_BUTTON_BRUSH_COLOR, -600 /* Click */, OnClickButtonBrushColor, VTS_NONE)
    //}}AFX_EVENTSINK_MAP
    END_EVENTSINK_MAP()//{{AFX_MSG(CHotSpotView)
    afx_msg void OnClickPlay();
    afx_msg void OnClickPause();
    afx_msg void OnClickStop();
    afx_msg void OnClickBack();
    afx_msg void OnClickForward();
    afx_msg void OnOnPlayStateChangeRealplayer1(long lNewState);
    afx_msg void OnOnPositionChangeRealplayer1(long lPos, long lLen);
    afx_msg void OnOnStateChangeRealplayer1(long lOldState, long lNewState);
    DECLARE_EVENTSINK_MAP()
    //}}AFX_MSG
      

  4.   

    谢谢!RealPlayer控件其它很多消息呢?再麻烦你一次啦:D
      

  5.   

    我重装了RealPlayer Plus 8.0 还是不能设置它的Events,请把所有的RealPlayer消息映射都帮我贴出来好吗?
    我要所有的RealPlayer控件消息映射
      

  6.   

    jimware:   I 服 you!!   如下:BEGIN_EVENTSINK_MAP(CTest643Dlg, CDialog)
        //{{AFX_EVENTSINK_MAP(CTest643Dlg)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1010 /* OnAuthorChange */, OnOnAuthorChangeRealplayer1, VTS_BSTR)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1041 /* OnBuffering */, OnOnBufferingRealplayer1, VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 303 /* OnClipClosed */, OnOnClipClosedRealplayer1, VTS_NONE)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 302 /* OnClipOpened */, OnOnClipOpenedRealplayer1, VTS_BSTR VTS_BSTR)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1016 /* OnContacting */, OnOnContactingRealplayer1, VTS_BSTR)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1011 /* OnCopyrightChange */, OnOnCopyrightChangeRealplayer1, VTS_BSTR)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1014 /* OnErrorMessage */, OnOnErrorMessageRealplayer1, VTS_I2 VTS_I4 VTS_I4 VTS_BSTR VTS_BSTR VTS_BSTR)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 301 /* OnGotoURL */, OnOnGotoURLRealplayer1, VTS_BSTR VTS_BSTR)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1038 /* OnKeyDown */, OnOnKeyDownRealplayer1, VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1040 /* OnKeyPress */, OnOnKeyPressRealplayer1, VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1039 /* OnKeyUp */, OnOnKeyUpRealplayer1, VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1031 /* OnLButtonDown */, OnOnLButtonDownRealplayer1, VTS_I4 VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1032 /* OnLButtonUp */, OnOnLButtonUpRealplayer1, VTS_I4 VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1037 /* OnMouseMove */, OnOnMouseMoveRealplayer1, VTS_I4 VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1008 /* OnMuteChange */, OnOnMuteChangeRealplayer1, VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1013 /* OnPlayStateChange */, OnOnPlayStateChangeRealplayer1, VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1005 /* OnPositionChange */, OnOnPositionChangeRealplayer1, VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1018 /* OnPostSeek */, OnOnPostSeekRealplayer1, VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1021 /* OnPreFetchComplete */, OnOnPreFetchCompleteRealplayer1, VTS_NONE)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1017 /* OnPreSeek */, OnOnPreSeekRealplayer1, VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1020 /* OnPresentationClosed */, OnOnPresentationClosedRealplayer1, VTS_NONE)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1019 /* OnPresentationOpened */, OnOnPresentationOpenedRealplayer1, VTS_NONE)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1034 /* OnRButtonDown */, OnOnRButtonDownRealplayer1, VTS_I4 VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1035 /* OnRButtonUp */, OnOnRButtonUpRealplayer1, VTS_I4 VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 304 /* OnShowStatus */, OnOnShowStatusRealplayer1, VTS_BSTR)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1042 /* OnStateChange */, OnOnStateChangeRealplayer1, VTS_I4 VTS_I4)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1015 /* OnStatsInfoChange */, OnOnStatsInfoChangeRealplayer1, VTS_BSTR)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1009 /* OnTitleChange */, OnOnTitleChangeRealplayer1, VTS_BSTR)
    ON_EVENT(CTest643Dlg, IDC_REALPLAYER1, 1007 /* OnVolumeChange */, OnOnVolumeChangeRealplayer1, VTS_I2)
    //}}AFX_EVENTSINK_MAP
    END_EVENTSINK_MAP()void CTest643Dlg::OnOnAuthorChangeRealplayer1(LPCTSTR bstrAuthor) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnBufferingRealplayer1(long lFlags, long lPercentage) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnClipClosedRealplayer1() 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnClipOpenedRealplayer1(LPCTSTR shortClipName, LPCTSTR url) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnContactingRealplayer1(LPCTSTR bstrContacting) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnCopyrightChangeRealplayer1(LPCTSTR bstrCopyright) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnErrorMessageRealplayer1(short uSeverity, long uRMACode, long uUserCode, LPCTSTR pUserString, LPCTSTR pMoreInfoURL, LPCTSTR pErrorString) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnGotoURLRealplayer1(LPCTSTR url, LPCTSTR target) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnKeyDownRealplayer1(long nFlags, long nKey) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnKeyPressRealplayer1(long nFlags, long nKey) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnKeyUpRealplayer1(long nFlags, long nKey) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnLButtonDownRealplayer1(long nFlags, long nX, long nY) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnLButtonUpRealplayer1(long nFlags, long nX, long nY) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnMouseMoveRealplayer1(long nFlags, long nX, long nY) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnMuteChangeRealplayer1(long bMute) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnPlayStateChangeRealplayer1(long lNewState) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnPositionChangeRealplayer1(long lPos, long lLen) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnPostSeekRealplayer1(long lOldTime, long lNewTime) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnPreFetchCompleteRealplayer1() 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnPreSeekRealplayer1(long lOldTime, long lNewTime) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnPresentationClosedRealplayer1() 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnPresentationOpenedRealplayer1() 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnRButtonDownRealplayer1(long nFlags, long nX, long nY) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnRButtonUpRealplayer1(long nFlags, long nX, long nY) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnShowStatusRealplayer1(LPCTSTR statusText) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnStateChangeRealplayer1(long lOldState, long lNewState) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnStatsInfoChangeRealplayer1(LPCTSTR bstrStats) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnTitleChangeRealplayer1(LPCTSTR bstrTitle) 
    {
    // TODO: Add your control notification handler code here

    }void CTest643Dlg::OnOnVolumeChangeRealplayer1(short nVol) 
    {
    // TODO: Add your control notification handler code here

    }
      

  7.   

    声明: // Generated message map functions
    //{{AFX_MSG(CTest643Dlg)
    afx_msg void OnOnAuthorChangeRealplayer1(LPCTSTR bstrAuthor);
    afx_msg void OnOnBufferingRealplayer1(long lFlags, long lPercentage);
    afx_msg void OnOnClipClosedRealplayer1();
    afx_msg void OnOnClipOpenedRealplayer1(LPCTSTR shortClipName, LPCTSTR url);
    afx_msg void OnOnContactingRealplayer1(LPCTSTR bstrContacting);
    afx_msg void OnOnCopyrightChangeRealplayer1(LPCTSTR bstrCopyright);
    afx_msg void OnOnErrorMessageRealplayer1(short uSeverity, long uRMACode, long uUserCode, LPCTSTR pUserString, LPCTSTR pMoreInfoURL, LPCTSTR pErrorString);
    afx_msg void OnOnGotoURLRealplayer1(LPCTSTR url, LPCTSTR target);
    afx_msg void OnOnKeyDownRealplayer1(long nFlags, long nKey);
    afx_msg void OnOnKeyPressRealplayer1(long nFlags, long nKey);
    afx_msg void OnOnKeyUpRealplayer1(long nFlags, long nKey);
    afx_msg void OnOnLButtonDownRealplayer1(long nFlags, long nX, long nY);
    afx_msg void OnOnLButtonUpRealplayer1(long nFlags, long nX, long nY);
    afx_msg void OnOnMouseMoveRealplayer1(long nFlags, long nX, long nY);
    afx_msg void OnOnMuteChangeRealplayer1(long bMute);
    afx_msg void OnOnPlayStateChangeRealplayer1(long lNewState);
    afx_msg void OnOnPositionChangeRealplayer1(long lPos, long lLen);
    afx_msg void OnOnPostSeekRealplayer1(long lOldTime, long lNewTime);
    afx_msg void OnOnPreFetchCompleteRealplayer1();
    afx_msg void OnOnPreSeekRealplayer1(long lOldTime, long lNewTime);
    afx_msg void OnOnPresentationClosedRealplayer1();
    afx_msg void OnOnPresentationOpenedRealplayer1();
    afx_msg void OnOnRButtonDownRealplayer1(long nFlags, long nX, long nY);
    afx_msg void OnOnRButtonUpRealplayer1(long nFlags, long nX, long nY);
    afx_msg void OnOnShowStatusRealplayer1(LPCTSTR statusText);
    afx_msg void OnOnStateChangeRealplayer1(long lOldState, long lNewState);
    afx_msg void OnOnStatsInfoChangeRealplayer1(LPCTSTR bstrStats);
    afx_msg void OnOnTitleChangeRealplayer1(LPCTSTR bstrTitle);
    afx_msg void OnOnVolumeChangeRealplayer1(short nVol);
    DECLARE_EVENTSINK_MAP()
    //}}AFX_MSG
      

  8.   

    谢谢你fohoo飞狐兄,解决了我的燃眉之急!
    请问你是怎么得到这些消息映射的?我试了N次都不行:(