m_player.SetUrl()在VC++中如何定义 m_player变量?

来源:百度知道 编辑:UC知道 时间:2024/06/28 00:13:05
G:\MULTIMEDIA\WMPlayer\WMPLAYERDlg.cpp(181) :
error C2065: 'm_player' : undeclared identifier
G:\MULTIMEDIA\WMPlayer\WMPLAYERDlg.cpp(181) :
error C2228: left of '.SetUrl' must have class/struct/union type
执行 cl.exe 时出错.
源程序是 if(dlg.DoModal()==IDOK)
{ CString path=dlg.GetPathName();
m_player.SetUrl(path);
}

为你的WMPlayer的控件添加一个control型的成员变量,名字为m_player。
步骤:1,右键 WMPlayer控件 选择:建立类向导。英文版的就是 ClassWizad。
2,在弹出的对话框中选择“Member Variables”选项卡。
3, 在Objects IDs的选框中选择:你的WMPlayer控件的ID,默认是IDC_OCX1。点击对话框右边的 “Add Variables”。
4,输入m_player。就可以啦。
欢迎继续讨论