| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
HTML Help.
Anyone know how you can make a html help in your mfc program. I'm not sure I should ask this question this way. If someone knows what i´m talking about and has the answer, then please help.
Thanks. Ólafur Marteinsson C/C++ Programmer |
|
#2
|
|||
|
|||
|
Re: HTML Help.
I did it but the answer is not a short one.
First, go get the latest Html Help package from http://msdn.microsoft.com/workshop/author/htmlhelp Follow the instructions to use HHCtrl.ocx in your project. Override WinHelp() in your main frame class and do whatever is done in CWnd::WinHelp but instead of calling ::WinHelp() call your own function which will support HtmlHelp. This function could look like this: // Explicit linking of HHCtrl.ocx typedef HWND (WINAPI* FPHH)(HWND, LPCSTR, UINT, DWORD); FPHH g_pHtmlHelp=NULL; // Function pointer BOOL CMainFrame::ShowHtmlHelp(DWORD dwData, UINT nCmd) { BOOL bOK=FALSE; // Explicit linking of HHCtrl.ocx if (g_pHtmlHelp==NULL) { HINSTANCE hInstHtmlHelp=LoadLibrary(_T("HHCtrl.ocx")); ASSERT(hInstHtmlHelp!=NULL); if (hInstHtmlHelp!=NULL) (FARPROC&)g_pHtmlHelp=GetProcAddress(hInstHtmlHelp, _T("HtmlHelpA")); } CString strHtmlHelpFile(GetHtmlHelpFile()); if ((g_pHtmlHelp!=NULL) && (_access(strHtmlHelpFile, 0)==0)) { HWND hWndResult=NULL; CWnd* pWnd = GetDesktopWindow(); // Avoid to have the help window always on top if (nCmd==HELP_PARTIALKEY) { // Keyword (from interpreter documents or Expression Builder) HH_AKLINK akLink={ sizeof(HH_AKLINK), // cbStruct - sizeof this structure FALSE, // fReserved - must be FALSE (really!) (LPCTSTR)dwData, // pszKeywords - semi-colon separated keywords "", // pszUrl - URL to jump to if no keywords found (may be NULL) "", // pszMsgText - Message text to display in MessageBox if pszUrl is NULL and no keyword match "", // pszMsgTitle - Message text to display in MessageBox if pszUrl is NULL and no keyword match "", // pszWindow - Window to display URL in TRUE}; // fIndexOnFail - Displays index if keyword lookup fails. hWndResult=g_pHtmlHelp( pWnd->GetSafeHwnd(), strHtmlHelpFile, HH_KEYWORD_LOOKUP, (DWORD)&akLink); } else if (nCmd==HELP_CONTEXT) { // Context help (using ID) hWndResult=g_pHtmlHelp( pWnd->GetSafeHwnd(), strHtmlHelpFile, HH_HELP_CONTEXT, dwData); if (hWndResult==NULL) { // Wrong ID: show the index hWndResult=g_pHtmlHelp( pWnd->GetSafeHwnd(), strHtmlHelpFile, HH_DISPLAY_TOPIC, 0); } } else { // Show index hWndResult=g_pHtmlHelp( pWnd->GetSafeHwnd(), strHtmlHelpFile, HH_DISPLAY_TOPIC, 0); } if (hWndResult!=NULL) bOK=TRUE; } return bOK; } I hope this helps. |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|