基于对话框的程序如何使用加速键?
m_haccel=::loadaccelerators(afxgetinstancehandle(),makeintresource(idr_accelerator1));//加速键id
重载pretranslatemessage函数:
bool cdlg::pretranslatemessage(msg* pmsg)
{
// todo: add your specialized code here and/or call the base class
if(m_haccel!=null)
if(::translateaccelerator(m_hwnd,m_haccel,pmsg))
return true;
return cdialog::pretranslatemessage(pmsg);
}
6,怎么把一个文件保存到其它地方?
if(!copyfile("f:\\he.txt","d:\\he1.txt",true))
{
if(idok == messagebox("有同名文件,你要覆盖吗?",null,mb_okcancel))
{
copyfile("f:\\he.txt","d:\\he1.txt",false);
}
else
return;
}