Click to See Complete Forum and Search --> : Problems with HTML help


Kevin C
June 1st, 1999, 08:28 AM
Occassionally when launching HTML help from my application an error as such will be received:

‘failed to initialize WININET32.DLL’
‘failed to load HHCTRL.OCX.’

Sometimes the dll that failed to initialize is mshtml.dll or jscript.dll. This error only happens on NT 4.0 (SP 4). Strangely enough, if you double click on the .chm file or launch from the shortcut that is created during our install the help file will open without incident.

Does anyone have any experience with this type of error or know how I might begin to debug it? Our app is built with VB 5.0 and MSVC 5.0 and we use HTML help 1.2. All of our test PC's have IE 4.01 SP1 installed.

The code used to load the help files is as follows:

typedef HWND (WINAPI *LPFNHTMLHELP)(HWND hWnd, LPCSTR lpHFile, UINT lCmd, DWORD dwData);

static HINSTANCE hInstHelp = NULLHINSTANCE;
static LPFNHTMLHELP lpfnHelpProc = 0;

STDEXPORTP(HWND) SAWinHelp(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD dwData)
{
HWND hWndRt = NULLHWND;
SetCursorWait();
if (*pszFile == 0)
pszFile = lpGetSAHelpFile(0);

if (NULLHINSTANCE == hInstHelp)
{
lpfnHelpProc = 0;
hInstHelp = LoadLibrary("hhctrl.ocx");

if (hInstHelp)
{
lpfnHelpProc = (LPFNHTMLHELP)GetProcAddress(hInstHelp, ATOM_HTMLHELP_API_ANSI);
}
else
{
MessageBox(lpA->hWndFrame, "Help failed: Unable to load hhctrl.ocx", "SA/2001 Help", MB_ICONERROR);
ResetCursorWait();
return hWndRt;
}
}

if (lpfnHelpProc)
{
// Owned mode (always on top of app)
hWndRt = lpfnHelpProc(hwndCaller, pszFile, uCommand, dwData);
// Sibling mode
// hWndRt = lpfnHelpProc((HWND)0, pszFile, uCommand, dwData);

if (!hWndRt)
{
char ctmp1[1024];

if (HH_DISPLAY_TOPIC == uCommand)
{
wsprintf(ctmp1, "Unable to load Help File %s.", pszFile);
MessageBox(lpA->hWndFrame, ctmp1, "SA/2001 Help", MB_ICONERROR);
}
else if (HH_DISPLAY_INDEX == uCommand)
{
wsprintf(ctmp1, "Unable to load Help File %s.", pszFile);
MessageBox(lpA->hWndFrame, ctmp1, "SA/2001 Help", MB_ICONERROR);
}
else if (HH_HELP_CONTEXT == uCommand)
{
int imsgRt = 0;

wsprintf(ctmp1, "The requested help topic was not found.\nChoose OK to search the index.\n(help topic code %ld)", dwData);

imsgRt = MessageBox(lpA->hWndFrame, ctmp1, "SA/2001 Help", MB_ICONEXCLAMATION | MB_OKCANCEL);
if (imsgRt == IDOK)
{
hWndRt = SAWinHelp(hwndCaller, pszFile, HH_DISPLAY_INDEX, 0);
}
}
else
{
wsprintf(ctmp1, "Help failed: File %s, Command 0x%4.4lx, Data 0x%4.4lx", pszFile, uCommand, dwData);
MessageBox(lpA->hWndFrame, ctmp1, "SA/2001 Help", MB_ICONERROR);
}

}
}
else
{
MessageBox(lpA->hWndFrame, "Help failed: Unable to access htmlhelp function", "SA/2001 Help", MB_ICONERROR);
}


ResetCursorWait();

return hWndRt;
}