Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a VC++ 2008 MDI project which has a left pane of a CTreeView and the right pane is a property sheet with property pages. (This is a project which was upgraded from VC 6.0 and the WinHelp system worked great. The chm file is the same by the way.)

In my application ('theApp') I have the call to EnableHtmlHelp() plus my function:

void CWinApp::HtmlHelp(DWORD_PTR dwData, UINT nCmd)

From there, the ::HtmlHelp() function is called using the HH_HELP_CONTEXT command.

The right pane property sheet has the pre-translate function which captures the F1 key press and passes the dialog help index to the HtmlHelp function in 'theApp'. The correct topic help is displayed as it used to in VC 6.0.

The CTreeView class CLeftView also captures the F1 key press and passes the tree item's help index to the HtmlHelp function in 'theApp'. For some reason this call is overridden by another call to the HtmlHelp in MFC's Wincore.cpp with the default main help topic instead of the one that was sent for the tree item. (I have also tried to capture the F1 key in the pretranslate in the Child Frame with the same results.)

Any ideas what may be causing the problem?
Posted
Updated 15-Jun-10 11:20am
v5
Comments
Moak 9-Jun-10 15:11pm    
Updated subject and tags, hope this helps :)

1 solution

I found a solution to the problem and now the help system returns a customized help topic for the specific tree item the user is on.

I removed the PreTranslateMsg() function from the CLeftView (left pane) and added the OnCommandHelp() function to the Child Frame:

ChildFrm.h
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);

ChildFrm.cpp
LRESULT CChildFrame::OnCommandHelp(WPARAM wParam, LPARAM lParam)
{
if((lParam == 0) && (GetLeftPane() != NULL))
{
theApp.HtmlHelp(GetLeftPane()->m_dwCurItem, HELP_CONTEXT);
return TRUE;
}

return FALSE;
}
 
Share this answer
 
Comments
Hans Dietrich 16-Jun-10 0:37am    
Thanks for sharing the solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900