01-09-2025 10:59 AM
I have two HTML help (.chm) files: USER_HELP_FILE and ERR_HELP_FILE
when I open USER_HELP_FILE selecting a menu item my source code is the following:
int status;
status = ShowHtmlHelp(NULL, HH_CLOSE_ALL, NULL);
status = ShowHtmlHelp(USER_HELP_FILE, HH_DISPLAY_TOC, NULL);
the same when I open ERR_HELP_FILE
int status;
status = ShowHtmlHelp(NULL, HH_CLOSE_ALL, NULL);
status = ShowHtmlHelp(ERR_HELP_FILE, HH_DISPLAY_TOC, NULL);
using these instructions in Operative System Windows10 all was ok
using these instructions in Operative System Windows11 when I open the second HTML help (.chm) file, the first one is not closed and the second is not correctly open. After some seconds my application crash
Could you please help me? Thank you very much
Solved! Go to Solution.
01-10-2025 05:02 AM
The usual answer to questions like these is: do functions return any error? I.e. is there some meaningful value in 'status' variable on the defective systems?
After that, you could search into the event viewer any error message related to your application and see if it sheds some light on the situation.
01-10-2025 08:50 AM
when I open the first HTML help (.chm) file:
the status = ShowHtmlHelp(NULL, HH_CLOSE_ALL, NULL); has value = -5001
the status = ShowHtmlHelp(XXX_HELP_FILE, HH_DISPLAY_TOC, NULL); has value = 0
but the first HTML help (.chm) file is open correctly
when I open the second HTML help (.chm) file:
the status = ShowHtmlHelp(NULL, HH_CLOSE_ALL, NULL); has value = -5001
the status = ShowHtmlHelp(XXX_HELP_FILE, HH_DISPLAY_TOC, NULL); has value = 0
error -5001 = "Could Not Open File For Reading"
But I don't understand, because I use the instruction ShowHtmlHelp(NULL, HH_CLOSE_ALL, NULL); to close all HTML help (.chm) files previous opened...
Could you please help me? Thank you very much
01-11-2025 07:42 AM
I cannot help you since I am not using ShowHtmlHelp function, but since it is distributed in the Programmer's Toolbox whose source code is available you could place a breakpoint in it and run it step-by-step: this way you will be able to detect the exact function that returns the error.
Apart from this, I wonder if passing a full pathname to the function wouldn't help.
01-13-2025 09:17 AM
finally a colleague of mine solved the problem:
the problem was that in the help name there are spaces:
sprintf( USER_HELP_FILE, "%s\\help\\%s\\User Manual.chm", DIR_BASE, LANGUAGE);
I correct it in:
sprintf( USER_HELP_FILE, "%s\\help\\%s\\User_Manual.chm", DIR_BASE, LANGUAGE);
I rename the file .chm from "User Manual.chm" to "User_Manual.chm"
and all works properly!!!
01-14-2025 01:59 AM
Ah, we couldn't have guessed it not knowing the file names!
I'm glad you solved your problem.