Help button get chm instead of hlp  
Author Message
Simon Heffer





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

I have a application built around a CPropertySheet derived class. The help button is looking for 'app.hlp' file (this is the default MFC stuff, I've not added anything other than moving the button). How do I get it to look for a 'app.chm' file instead

I've tried the following using a test help file in InitInstance()

//First free the string allocated by MFC at CWinApp startup.
//The string is allocated before InitInstance is called.
free((void*)m_pszHelpFilePath);
//Change the name of the .HLP file.
//The CWinApp destructor will free the memory.
m_pszHelpFilePath=_tcsdup(_T("C:\\filezilla\\filezilla.chm"));
    EnableHtmlHelp();

but i just get "Failed to launch help"


Visual C++4  
 
 
Ted.





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

You need to call EnableHtmlHelp in your CWinApp derived constructor, not in the InitInstance. See

http://msdn2.microsoft.com/en-US/library/f08efa3d(VS.80).aspx


 
 
Simon Heffer





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

Good point.
Same result though

 
 
Simple Samples





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

This is a MFC question that really should be asked in a MFC newsgroup; see The scope of this forum.

I happen to have an article that might help with MFC for VC 6 but I assume that won't help you since this forum is for later versions of VC.



 
 
Simon Heffer





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

I'm using VS 2005. I thought HtmlHelp was actually an SDK I don't mind cross -posting if I get an answer though!

 
 
Ted.





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

It works for me.  Here's what I did:

1) Launch Visual C++ 2005

2) Create a new MFC project (application)

3) In the wizard, enable HTML Help

4) In my CWinApp derived class InitInstance, just before the call to the base class CWinApp::InitInstance, insert the following code:

free((void*)m_pszHelpFilePath);

m_pszHelpFilePath=_tcsdup(_T("c:\\test.chm"));

5) Copy a test.chm to the root of my C drive

6) Build and launch the application

7) Chose Help - Help topics. 

You'll see that the HTML Help file launches fine


 
 
Viorel.





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

I think you can also consider calling of SetHelpMode(afxHTMLHelp) somewhere in your InitInstance function, without other changes. In this case MFC should look for CHM file instead of HLP.

 

I hope this works.


 
 
Ted.





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

Actually in the wizard generated app I gave, the SetHelpMode is already done in the CWinApp derived constructor (where it should be done) in the call to EnableHtmlHelp (which is eqivalent to what you mentioned)
 
 
Simple Samples





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

Note that you would get faster, more accurate and complete answers in the MFC newsgroup. Actually the fastest answers can be obtained in the documentation; this is something that would be in the documentation.

 
 
Simon Heffer





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

Thanks Ted.
Yes I tried it from scratch too and had no problem. My app is a CPropertySheet which is a CWnd. Not sure if that makes a difference

 
 
Ayman Shoukry - MSFT





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

Sam,

For VC2005 MFC issues, these forums are the proper locations.

Thanks,
Ayman Shoukry
VC++ Team


 
 
Simple Samples





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

Sam,

For VC2005 MFC issues, these forums are the proper locations.

Thanks,
Ayman Shoukry
VC++ Team
That sounds good to me. I posted some relevant comments in AfxGetThread from non-MFC thread.

 
 
Ayman Shoukry - MSFT





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

Thanks for your understanding!

To be more clear. These forums are for VC++ 2005 specific issues.

The MFC is part of the libraries owned by the VC++ Team.

Thanks,
Ayman Shoukry
VC++ Team



 
 
CARTHIC





PostPosted: Visual C++ General, Help button get chm instead of hlp Top

I got the same error but in VISTA os...can u tell the way to clear the bug