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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.


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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

764 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