News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

HtmlHelp function

Started by raymond, July 08, 2009, 03:51:17 AM

Previous topic - Next topic

jj2007

I am using the version of 10.08.2004 (2746 bytes, attached) in RichMasm (updated yesterday), and it works fine. Well, by the standards of M$, of course :wink

[attachment deleted by admin]

raymond

UTTERLY TOTALY FRUSTRATING

I've finaly succeeded in calling a specific topic from a compiled help file whenever I need it. The program works like a charm under Win98. However, it crashes under a very peculiar circumstance with WinXP (SP3 Home Edition). I don't know yet how it would behave under Vista.

The program uses a half dozen different modal dialog boxes to get different kinds of input. Because the menu of the main window is not available to access the help file while the dialog box is open, I added a HELP button to each of those dialog boxes. And it is designed to open the help file at the topic related to that dialog box.

The frustrating part is that the program runs without crashing if I never call the help file. It also runs without crashing if I access all the dialog boxes and call the help file from each of them EXCEPT ONE. Whenever I open that particular dialog box and call the help file, the program will crash as soon as I call the help file from elsewhere or when I close the program (after closing the dialog box). The help file is called in exactly the same manner as with the other dialog boxes and from the main menu.

The exception code is always c0000005. The module where the exception occurs is generally "unknown" with the address either very low or very high. But I have seen ole32.dll indicated as the module on a few occasions, specially after calling the help file (and closing it) from numerous dialog boxes.

When I run the program with Ollydbg, it NEVER crashes when I call the help file from that dialog box and then call the help file from somewhere else or close the program immediately. However, I have succeeded in eventually crashing it with Ollydbg if I call the help file from that dialog box numerous times!!!!
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

ToutEnMasm

To raymond,
Perhaps you could post your code or only the part with the help topic ?.
It will be more easy to help you.

raymond

#18
ENIGMA SOLVED

My program needed to access numerous relatively small data files which could vary in length with input. Whenever access to those files was needed by some part of the program, memory was allocated to read the file, usually in the 0x140000-0x160000 memory address space due to their small size. The memory handle was generally freed before returning from that task. In some cases, wanting to reuse the same variable to store another memory handle, the current value was released as a precaution against memory leak before reassigning another handle to that variable.

The hhctrl.ocx also requires some small chunks of memory whenever the Htmlhelp function is called. This was also being allocated in the same memory space, in areas which had been released by my program. By inadvertantly releasing it once more, it would have trashed some of the info required by the hhctrl.ocx to function properly, resulting in failures and crashes. This was not happening when using the HLP file probably because the WinHelp function did not require any memory allocation.

After reviewing my code in detail and modifying a few instructions to completely avoid duplicate release of any memory handles, the program now works like a charm.

As a side note, the htmlhelp.lib (1999 version) provided with the CHM HELP Workshop does not seem to rely on the hhctrl.ocx but will not assemble with the MASM32 package due to some missing exports. The htmlhelp.lib (Aug 2004 version) mentioned earlier in this thread works fine as long as a proper .inc file is provided. I've extracted some of the more important constants from the header file in the CHM HELP Workshop and included them in my htmlhelp.inc file which is attached. It may be a good idea if Hutch could include it in the next release of MASM32 (along with the htmlhelp.lib, Aug 2004 version, if considered redistributable).


[attachment deleted by admin]
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

jj2007


ToutEnMasm


The htmlhelp.h is fully translated in the sdk rc7 here
http://www.masm32.com/board/index.php?topic=11531.msg86280#msg86280
The htmlhelp.sdk has more defines that the one posted,since further version of the sdk.

raymond

ANOTHER HORROR STORY

I have another small program in the public domain to which I added another feature. While at it, I also wanted to provide it with a CHM help file instead of the HLP one, so that Vista users would be accomodated.

Everything works fine with one exception: IF I load a data file to process it without first calling the help file, that help file never gets displayed when I subsequently call it. Otherwise, if I call the help file before loading a data file, I can load any number of them (one at a time) and the help file gets displayed correctly any time I call it.

Although I don't like this patch, my current solution has been to call the help file, followed by an immediate HH_CLOSE_ALL command, just before I give control to the GetMessage loop for the main window. :green
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

dedndave

there must be a solution to this
i have no vista to test on, though
i don't really like vista - lol