How to open HtmlHelp Viewer window using HH API and Watcom compiler?

Posted on 2003-02-19
Medium Priority
Last Modified: 2013-12-03
My first-ever question to Experts-Exchange follows:

I have to add HtmlHelp based help system for my application, which is being developed using Watcom 11 ('96) compiler.
I have a problem opening the HtmlHelp viewer window using HtmlHelp API.

First thing I've tried was doing it by the book (HtmlHelp Workshop + docs). I've added htmlhelp.lib from the workshop, but when I simply call:
 HtmlHelp(GetActiveWindow(), "GM.chm", HH_DISPLAY_TOPIC, NULL);
I get no response - an hourglass cursor shows for a second, but nothing appears and the function returns 0.
I've tried adding "mk:@MSITStore:" in the beginning of the file's path, as someone has done somehere or "::/topic.htm" in the end, but for no good.

I've downloaded "The C++ Builder HH Kit" from www.helpware.net. It contains a htmlhelp.lib file that works fine in Borland C++ Builder, but when I attached it to my Watcom project's target I'd got the following errors list while trying to build the project:

wmake -f c:\sysman\sysman5.mk -h -e c:\sysman\win\gmsysw.exe
cd c:\sysman\win
%create sqlfrmw.lb1
wlib -b -c -n -q -p=512 sqlfrmw.lib @sqlfrmw.lb1
wlink name gmsysw d all SYS nt_win op m libp .\;c:\sqlany50\win32\lib libf odbc32.lib op maxe=25 op q op symf @gmsysw.lk1Error! E2028: _HtmlHelpA@16 is an undefined reference
file sqlfrmw.lib(c:\sysman\winio\hhelpapi.cpp): undefined symbol _HtmlHelpA@16
Error(E42): Last command making (c:\sysman\win\gmsysw.exe) returned a bad status
Error(E02): Make execution terminated
Execution complete

I thought that it might be some OMF/COFF handling problem, but someone from Sybase told me that Watcom handles both lib types.
Maybe this .lib is an import library and has to be used differently?

Maybe someone could provide a working example or a link to a sample that could work under Watcom.
I don't know much about COM, but I guess it's quite new - maybe that's the problem? Maybe the compiler doesn't know how to handle this?
I have Watcom 11 ('96) and don't know where to turn for help, as it seems this isn't supported any more and there are no newer versions... We plan to move to a different one (VS probably), but that's far future and it will take a lot of time to move the 1500 files of the project.

Please, I will appreciate any help.

Filip Skakun

PS. I've found that there might be some problems with incompatibility between COFF libs for VS5 and VS6 and that the new ones should be converted back to VS5 version to work under Watcom. That would be quite a hint if it is where the problem lies. Now - how do I convert it? The Watcom FAQ stated something about downloading MS PSDK, but there's no lib tool that would enable execution of:
LIB newlibrary.lib /CONVERT /LINK50COMPAT /OUT:oldlibrary.lib
Question by:xyzzer
  • 4
  • 3
LVL 49

Accepted Solution

DanRollins earned 800 total points
ID: 7985999
The first thing to do is try to open a CHM file that you did not build -- e.g., one from c:\WinNT\help.  And you must also me certain to provide the FULLY QUALIFIED PATH AND FILENAME in all such commands:

     HtmlHelp(GetActiveWindow(), "c:\\winnt\\help\\NOTEPAD.chm", HH_DISPLAY_TOPIC, NULL);

If that works, but you still can't open the CHM file that you created, then there is a problem with your CHM file.  Do you have the HTML Help tools from Microsoft?

-- Dan

Author Comment

ID: 7986524
Thanks Dan. After some 15 hours of intensive search across the web I've found how to convert the .lib. It seems almost nothing changed in the file after conversion (using lib tool from masm32v8) and actually I think it was already an older version of coff lib - it didn't help. I only then tried (just for kicks) adding the full path and was I surprised then to see the success! I've wanted to cancel this question somehow, but there was Your answer to come just minutes late. I think You deserve Your points though. :]
I wonder though, how is it that the Builder's .lib would accept it without the full path and the original .lib wouldn't? - Unless I don't know what's the path from which my application runs and where the .chm was located. :]
I thought HTMLHelp API could use some way of error notifications and there actually is a way, there's even an example in HH API documentation, but it's not yet implemented - so says .h. You could expect something better of Microsoft...
Thank You for Your help.

-- Filip
LVL 49

Expert Comment

ID: 7989613
I really don't understand why you were messing around with the LIB files.  

But the reason that an unqualifiled pathname works somethimes and fails sometimes has to do with the location of the executable program, the location of the CHM file, the PATH statement that is associated with an executable program, and the directory that the system considers to be the "current default directory" or "current working directory".   There are so many variables, that it is simply foolish to ever just hope that a 'bare' filename will work.  If you *always* specify a full pathspec:  
then you will avoid many errors and save countless hours of debugging.

-- Dan
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.


Author Comment

ID: 7994314
I know. I just didn't think of the possibility that the Watcom IDE would run the executable not from it's path, but from the path of the project file... I was just going to add the full path thing later on as it would need a few concatenations and knowledge of program variables that keep the resource path.
I've been messing around with LIB files because I couldn't find any other explanation of the thing and I've tried adding many silly things to the path and thought I've already tried the basic one.

no comments please

LVL 49

Expert Comment

ID: 7995593
>>no comments please
I won't add any more comments.  I promise.
-- Dan

Author Comment

ID: 7998518
Thanks :]
LVL 49

Expert Comment

ID: 8000679
You're welcome.

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question