实现的前提:你已经做好了帮助文件xx.chm,放于程序目录
实现的步骤:1。在你的cwinapp类头文件中添加onhelp()消息处理函数,如:
//{{afx_msg(ccaimappdlg)
afx_msg void onhelp();
//}}afx_msg
2。在cwinapp类cpp文件中添加消息映射:
//{{afx_msg_map
on_command( id_help, onhelp )
//}}afx_msg_map
3.添加onhelp()函数:
void ccaimappdlg::onhelp()
{
shellexecute(null,"open","xx.chm",null,null,sw_shownormal);
}
4.完成!
这样,在你按f1的时候就会打开你的帮助文件了,如果你想用别的方式,只要调用onhelp()函数或加语句sendmessage(wm_help);即可