//代码就不加注释了 一看就懂的了 ^_^
BOOL CXXXXXXXXDlg::PreTranslateMessage(LPMSG lpmsg)
{
BOOL bHandleNow = FALSE;
switch (lpmsg->message)
{
case WM_KEYDOWN:
switch (lpmsg->wParam)
{
case VK_F1:
{
// for F1 popup help documents follow language option
TCHAR szFilePath[MAX_PATH];
memset(szFilePath,0x00,MAX_PATH);
GetModuleFileName(NULL, szFilePath, MAX_PATH);
(_tcsrchr(szFilePath, _T('\\')))[1] = 0;TCHAR szPath[256];
// show the manual by the language ID
lstrcpy(szPath, _T("help.pdf"));
wcscat_s(szFilePath,szPath);
if(PathFileExists(szFilePath))
{
ShellExecute(NULL,_T("open"),szFilePath,NULL,NULL,SW_SHOW);
return TRUE;
}
}
break;
}
break;
}
return __super::PreTranslateMessage(lpmsg);
}
评论