VC雕虫小技集(六)[4]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 he_zhidan 的 blog

基于对话框的程序如何使用加速键?      

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;

       }

本文关键:VC 雕虫小技集
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top