Discussion:
HtmlHelp Errors in VS 2005
(too old to reply)
marathoner
2007-06-20 22:19:53 UTC
Permalink
In Visual C++ 6.0, I used the statement

HtmlHelp(m_pMainWnd->m_hWnd, m_pszHelpFilePath, HH_HELP_CONTEXT, dwData);

which compiled just fine. When I attempted to compile this statement in
VS2005, I get the following syntax error:

.\SampleFile.cpp(172) : error C2660: 'CWinApp::HtmlHelpA' : function does
not take 4 arguments


How do we fix this error?
David Wilkinson
2007-06-20 23:29:34 UTC
Permalink
Post by marathoner
In Visual C++ 6.0, I used the statement
HtmlHelp(m_pMainWnd->m_hWnd, m_pszHelpFilePath, HH_HELP_CONTEXT, dwData);
which compiled just fine. When I attempted to compile this statement in
.\SampleFile.cpp(172) : error C2660: 'CWinApp::HtmlHelpA' : function does
not take 4 arguments
How do we fix this error?
marathoner:

You need to write:

::HtmlHelp(m_pMainWnd->m_hWnd, m_pszHelpFilePath, HH_HELP_CONTEXT, dwData);

to get the global HtmlHelp() rather than CWinApp::HtmlHelp().
--
David Wilkinson
Visual C++ MVP
marathoner
2007-06-21 13:28:22 UTC
Permalink
Thank you, that fixed the compilation part of the problem.
Post by David Wilkinson
Post by marathoner
In Visual C++ 6.0, I used the statement
HtmlHelp(m_pMainWnd->m_hWnd, m_pszHelpFilePath, HH_HELP_CONTEXT, dwData);
which compiled just fine. When I attempted to compile this statement in
.\SampleFile.cpp(172) : error C2660: 'CWinApp::HtmlHelpA' : function does
not take 4 arguments
How do we fix this error?
::HtmlHelp(m_pMainWnd->m_hWnd, m_pszHelpFilePath, HH_HELP_CONTEXT, dwData);
to get the global HtmlHelp() rather than CWinApp::HtmlHelp().
--
David Wilkinson
Visual C++ MVP
Joseph M. Newcomer
2007-06-21 02:59:15 UTC
Permalink
Well, consulting the documentation for CWinApp::HtmlHelp, you can see that it takes two
parameters, so if you give it four, the compiler is *supposed* to complain! Note the
error mesage EXPLICITLY told you it was calling CWinApp::HtmlHelp, so it is very simple to
look it up in the documentation!

CWnd::HtmlHelp *also* takes two parameters, but in that case the error message would have
been different.

There is also an HtmlHelp API defined in htmlhelp.h, but that is an API, and therefore you
would not call it as
HtmlHelp(...)
but as
::HtmlHelp(...)

if you wrote the call in the context of a CWnd class or CWinApp class, the class member of
two parameters is the one that would be used. It is a very good idea to get into the
habit to ALWAYS write :: before any raw API call. An "undecorated" (not explicitly
specified to the global namespace) raw API call is generally bad style.
joe
Post by marathoner
In Visual C++ 6.0, I used the statement
HtmlHelp(m_pMainWnd->m_hWnd, m_pszHelpFilePath, HH_HELP_CONTEXT, dwData);
which compiled just fine. When I attempted to compile this statement in
.\SampleFile.cpp(172) : error C2660: 'CWinApp::HtmlHelpA' : function does
not take 4 arguments
How do we fix this error?
Joseph M. Newcomer [MVP]
email: ***@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Sonu
2007-06-26 19:27:00 UTC
Permalink
Hi,
I am facing a related problem:

::HtmlHelp( m_hWnd, path, HH_DISPLAY_TOPIC, NULL) ;

This gives me a linking error:
unresolved external symbol ***@16 .......
This is a unicode MFC program compiled in VS2005

Thanks for all the help
Srishti
Post by Joseph M. Newcomer
Well, consulting the documentation for CWinApp::HtmlHelp, you can see that it takes two
parameters, so if you give it four, the compiler is *supposed* to complain! Note the
error mesage EXPLICITLY told you it was calling CWinApp::HtmlHelp, so it is very simple to
look it up in the documentation!
CWnd::HtmlHelp *also* takes two parameters, but in that case the error message would have
been different.
There is also an HtmlHelp API defined in htmlhelp.h, but that is an API, and therefore you
would not call it as
HtmlHelp(...)
but as
::HtmlHelp(...)
if you wrote the call in the context of a CWnd class or CWinApp class, the class member of
two parameters is the one that would be used. It is a very good idea to get into the
habit to ALWAYS write :: before any raw API call. An "undecorated" (not explicitly
specified to the global namespace) raw API call is generally bad style.
joe
Post by marathoner
In Visual C++ 6.0, I used the statement
HtmlHelp(m_pMainWnd->m_hWnd, m_pszHelpFilePath, HH_HELP_CONTEXT, dwData);
which compiled just fine. When I attempted to compile this statement in
.\SampleFile.cpp(172) : error C2660: 'CWinApp::HtmlHelpA' : function does
not take 4 arguments
How do we fix this error?
Joseph M. Newcomer [MVP]
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
MrAsm
2007-06-26 21:53:45 UTC
Permalink
Have you tried to link with HtmlHelp.lib ?

MrAsm
Joseph M. Newcomer
2007-07-01 02:00:31 UTC
Permalink
So did you read the documentation? This is always a good start in any project....

Whenver you get an undefined symbol, it means you don't have the module linked in. And
guess what! By reading the documentation, I discovered, on the very first page,
==================================
About Htmlhelp.lib
Htmlhelp.lib is an export library that exposes the HTML Help API and loads Hhctrl.ocx only
when HtmlHelp() is called. In addition, Htmlhelp.lib locates the registered Hhctrl.ocx.

By default, Htmlhelp.lib is located in the following directory:

C:\Program Files\HTML Help Workshop\Lib
==================================
So the obvious solution is to include this library in your link!

Documentation is a wonderful thing.
joe
Post by Sonu
Hi,
::HtmlHelp( m_hWnd, path, HH_DISPLAY_TOPIC, NULL) ;
This is a unicode MFC program compiled in VS2005
Thanks for all the help
Srishti
Post by Joseph M. Newcomer
Well, consulting the documentation for CWinApp::HtmlHelp, you can see that it takes two
parameters, so if you give it four, the compiler is *supposed* to complain! Note the
error mesage EXPLICITLY told you it was calling CWinApp::HtmlHelp, so it is very simple to
look it up in the documentation!
CWnd::HtmlHelp *also* takes two parameters, but in that case the error message would have
been different.
There is also an HtmlHelp API defined in htmlhelp.h, but that is an API, and therefore you
would not call it as
HtmlHelp(...)
but as
::HtmlHelp(...)
if you wrote the call in the context of a CWnd class or CWinApp class, the class member of
two parameters is the one that would be used. It is a very good idea to get into the
habit to ALWAYS write :: before any raw API call. An "undecorated" (not explicitly
specified to the global namespace) raw API call is generally bad style.
joe
Post by marathoner
In Visual C++ 6.0, I used the statement
HtmlHelp(m_pMainWnd->m_hWnd, m_pszHelpFilePath, HH_HELP_CONTEXT, dwData);
which compiled just fine. When I attempted to compile this statement in
.\SampleFile.cpp(172) : error C2660: 'CWinApp::HtmlHelpA' : function does
not take 4 arguments
How do we fix this error?
Joseph M. Newcomer [MVP]
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Joseph M. Newcomer [MVP]
email: ***@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
unknown
2008-12-05 06:50:01 UTC
Permalink
Besides the error :
.\SampleFile.cpp(172) : error C2660: 'CWinApp::HtmlHelpA' : function does
not take 4 arguments

VS2005 also complains about the HtmlHelp.h, It gives many syntax error regarding HtmlHelp.h

Such As:

error C2146: syntax error : missing ')' before identifier 'hwndCaller'

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

error C2059: syntax error : ')'


Any suggestion on how to solve?
Joseph M. Newcomer
2008-12-05 13:45:02 UTC
Permalink
I'm a bit confused. I am ABSOLUTELY CERTAIN it does not give the messages below. I am
ABSOLUTELY CERTAIN that it gives a line number with those messages. And I'm sure that if
I knew which version of the Platform SDK you were using, it would be easy to look up the
appropriate lines and determine why these errors occur. And I'll bet if you showed the
line in SampleFile.cpp that exhibits the other error you show, line 172, there is a
reasonable chance that the reason could be determined.

How are we supposed to answer questions this vague?

By the way, I'm getting a syntax error in my program, too. It says something about an
undefined symbol. What should I do?
joe
Post by marathoner
.\SampleFile.cpp(172) : error C2660: 'CWinApp::HtmlHelpA' : function does
not take 4 arguments
VS2005 also complains about the HtmlHelp.h, It gives many syntax error regarding HtmlHelp.h
error C2146: syntax error : missing ')' before identifier 'hwndCaller'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2059: syntax error : ')'
Any suggestion on how to solve?
Joseph M. Newcomer [MVP]
email: ***@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Tom Serface
2008-12-05 16:39:02 UTC
Permalink
Sometimes errors like this can be caused by other errors near the same place
in the file. For example, you may have left off a ( or ) for a function or
forgot to put a ; (semi-colon) on the end of a line. It could be thinking
that some other unintended code is part of this function call.

Tom
Post by marathoner
.\SampleFile.cpp(172) : error C2660: 'CWinApp::HtmlHelpA' : function does
not take 4 arguments
VS2005 also complains about the HtmlHelp.h, It gives many syntax error regarding HtmlHelp.h
error C2146: syntax error : missing ')' before identifier 'hwndCaller'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2059: syntax error : ')'
Any suggestion on how to solve?
Loading...