ICSAutomation
asked on
WinHelp in C++
Hello
I want to use WinHelp in a MFC application. I work with Visual Studio 2003.
I did already following:
// CUiApp Konstruktion
CUiApp::CUiApp()
{
EnableHtmlHelp();
// ZU ERLEDIGEN: Hier Code zur Konstruktion einfügen
// Alle wichtigen Initialisierungen in InitInstance platzieren
}
When I call the Help, I call
"ON_COMMAND(ID_HELP, CWinApp::OnHelp)"
the program jumps to apphelpx.cpp
void CWinApp::OnHelp() // use context to derive help context
{
if (m_dwPromptContext != 0)
{
// do not call WinHelp when the error is failing to lauch help
if (m_dwPromptContext != ID_BASE_PROMPT+AFX_IDP_FAI LED_TO_LAU NCH_HELP)
WinHelpInternal(m_dwPrompt Context);
return;
}
// otherwise, use CWnd::OnHelp implementation
CWnd* pWnd = AfxGetMainWnd();
ASSERT_VALID(pWnd);
if (!pWnd->IsFrameWnd())
pWnd->OnHelp();
else
((CFrameWnd*)pWnd)->OnHelp ();
}
at "pWnd->OnHelp();" the programm jumps to winfrmx.cpp
void CWnd::OnHelp() // use context to derive help context
{
// attempt to get help from whoever is tracking
HWND hWnd = ::GetCapture();
while (hWnd != NULL)
{
// attempt to process help
if (::SendMessage(hWnd, WM_COMMANDHELP, 0, 0))
return;
// check next parent/owner in the parent/owner chain
hWnd = AfxGetParentOwner(hWnd);
}
// attempt to get help from whoever has the focus
hWnd = ::GetFocus();
while (hWnd != NULL)
{
// attempt to process help
if (::SendMessage(hWnd, WM_COMMANDHELP, 0, 0))
return;
// check next parent/owner in the parent/owner chain
hWnd = AfxGetParentOwner(hWnd);
}
when the program is at " if (::SendMessage(hWnd, WM_COMMANDHELP, 0, 0))" it opens an error window with the message "Failed to launch help."
What can I do??
I want to use WinHelp in a MFC application. I work with Visual Studio 2003.
I did already following:
// CUiApp Konstruktion
CUiApp::CUiApp()
{
EnableHtmlHelp();
// ZU ERLEDIGEN: Hier Code zur Konstruktion einfügen
// Alle wichtigen Initialisierungen in InitInstance platzieren
}
When I call the Help, I call
"ON_COMMAND(ID_HELP, CWinApp::OnHelp)"
the program jumps to apphelpx.cpp
void CWinApp::OnHelp() // use context to derive help context
{
if (m_dwPromptContext != 0)
{
// do not call WinHelp when the error is failing to lauch help
if (m_dwPromptContext != ID_BASE_PROMPT+AFX_IDP_FAI
WinHelpInternal(m_dwPrompt
return;
}
// otherwise, use CWnd::OnHelp implementation
CWnd* pWnd = AfxGetMainWnd();
ASSERT_VALID(pWnd);
if (!pWnd->IsFrameWnd())
pWnd->OnHelp();
else
((CFrameWnd*)pWnd)->OnHelp
}
at "pWnd->OnHelp();" the programm jumps to winfrmx.cpp
void CWnd::OnHelp() // use context to derive help context
{
// attempt to get help from whoever is tracking
HWND hWnd = ::GetCapture();
while (hWnd != NULL)
{
// attempt to process help
if (::SendMessage(hWnd, WM_COMMANDHELP, 0, 0))
return;
// check next parent/owner in the parent/owner chain
hWnd = AfxGetParentOwner(hWnd);
}
// attempt to get help from whoever has the focus
hWnd = ::GetFocus();
while (hWnd != NULL)
{
// attempt to process help
if (::SendMessage(hWnd, WM_COMMANDHELP, 0, 0))
return;
// check next parent/owner in the parent/owner chain
hWnd = AfxGetParentOwner(hWnd);
}
when the program is at " if (::SendMessage(hWnd, WM_COMMANDHELP, 0, 0))" it opens an error window with the message "Failed to launch help."
What can I do??
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Actually I want to use a HtmlHelp (*.chm). That's way I put
>>EnableHtmlHelp();
>>EnableHtmlHelp();
Did you check if the help file exists?
ASKER
Sorry for writing "WinHelp" in my question. What I want to open is a HtmlHelp (*.chm) file.
Thanks for the links. I was through these already before. I found them with googeling a little bit...
I need a suggestion what I do wrong in my code. I there a parameter I have to set?
Has anybody an idea?
Thanks for the links. I was through these already before. I found them with googeling a little bit...
I need a suggestion what I do wrong in my code. I there a parameter I have to set?
Has anybody an idea?
ASKER
The help file exists, but I had it in the wrong folder :-( *stupid*
Thanks for this comment!
But now I get another error message:
HH_HELP_CONTEXT called without a [MAP] section.
What is this?
Thanks for this comment!
But now I get another error message:
HH_HELP_CONTEXT called without a [MAP] section.
What is this?
Please see:
http://www.codeguru.com/cpp/w-p/help/html/article.php/c6513 search for e.g. [MAP]
and
http://www.help-info.de/en/Help_Info_HTMLHelp/hh_context-id.htm
Best regards
Ulrich Kulle
************************
Microsoft Help MVP 2007-2009
www.help-info.de
************************
http://www.codeguru.com/cpp/w-p/help/html/article.php/c6513 search for e.g. [MAP]
and
http://www.help-info.de/en/Help_Info_HTMLHelp/hh_context-id.htm
Best regards
Ulrich Kulle
************************
Microsoft Help MVP 2007-2009
www.help-info.de
************************
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok, I understand that I have to MAP my HtmlHelp. I checked the links, but didn't really understand. I have to do something in the folder of the HtmlHelp and also in the C++ application. What I ahve to do where?
To get the right HelpFile, I added:
CUiApp::CUiApp()
{
EnableHtmlHelp();
m_pszHelpFilePath = _tcsdup(_T("D:\\Anlagen\\G sl1_ml\\PC S\\LsProg\ \Ui\\HelpH TML\\LShel p.chm"));
}
Is this correct?
To get the right HelpFile, I added:
CUiApp::CUiApp()
{
EnableHtmlHelp();
m_pszHelpFilePath = _tcsdup(_T("D:\\Anlagen\\G
}
Is this correct?
ASKER
All right. I did the maping in the HtmlHelp. (*.hhp)
[ALIAS]
IDH_90000 = ICS\PCS_UserManual.htm
[MAP]
#define IDH_90000 90000
--> Now I don't get the error " HH_HELP_CONTEXT called without a [MAP] " anymore! :-)
But I still get the message "Failed to launch help." :-(
What could still be wrong?
Do I have to add the number 90000 in th C++ code? Where I have to add it?
[ALIAS]
IDH_90000 = ICS\PCS_UserManual.htm
[MAP]
#define IDH_90000 90000
--> Now I don't get the error " HH_HELP_CONTEXT called without a [MAP] " anymore! :-)
But I still get the message "Failed to launch help." :-(
What could still be wrong?
Do I have to add the number 90000 in th C++ code? Where I have to add it?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@help-info
That is C++.net - which is quite different than MFC (which is unmanaged)
That is C++.net - which is quite different than MFC (which is unmanaged)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>I want to use WinHelp in a MFC application.
>>EnableHtmlHelp();
Which do you want to use? Winhelp or HTML based help, they are not the same.