Link to home
Start Free TrialLog in
Avatar of xyzzer
xyzzer

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xyzzer
xyzzer

ASKER

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
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:  
    d:\path\filename.ext
then you will avoid many errors and save countless hours of debugging.

-- Dan
Avatar of xyzzer

ASKER

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

--Filip
>>no comments please
I won't add any more comments.  I promise.
-- Dan
Avatar of xyzzer

ASKER

Thanks :]
You're welcome.