Re: [Dev-C++] HTMLHELP help urgently needed!
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Elias P. <eli...@ao...> - 2001-04-12 10:37:52
|
> I have the new ld now and your test program works fine. In my
> program, however, htmlhelp still returns 0, even when I copy the
> code from your program, so I can choose the help file. Does
> HtmlHelp provide a way to receive a detailed error message (so I
> know what's going wrong) and what could be going wrong? We have
> the same types of WNDCLASSEXs and the basically the same settings
> in the two programs, except my program has multiple source files,
> and a lot more resources.
>
I don't know, but on the mingw list someone also said the .lib
wouldn't work. They created a htmlhelp.a library instead. Another way
is to directly load the library. This is the method i'm using to
access the DX8 dll. I just tried it, and it works here as well. ( so
the following code probably works with every .dll where you have no .a
file)
Instead of linking with the htmlhelp.lib, add code similiar to the
following to your project. (the atexit and MessageBox stuff is just
how I do it, you only need LoadLibrary and GetProcAddress) In my
example it works just like the .lib version, but maybe it's more
stable.
#include <stdlib.h> // declares atexit function
// the htmlhelp library
HMODULE htmlhelp=NULL;
// pointer to function we want to use
HWND WINAPI (*htmlhelp_HtmlHelpA)(HWND,LPCSTR,UINT,DWORD_PTR)=NULL;
// unload the htmlhelp library
void unload_htmlhelp_library(void) {
FreeLibrary(htmlhelp);
}
// load the htmlhelp library
void load_htmlhelp_library(void) {
htmlhelp=LoadLibrary("hhctrl.ocx");
if(htmlhelp==NULL) {
MessageBox(NULL,"Can't load hhctrl.ocx","Error",MB_OK);
exit(-1);
}
// ensure the library gets unloaded again
atexit(unload_htmlhelp_library);
htmlhelp_HtmlHelpA =
(void *) GetProcAddress(htmlhelp, "HtmlHelpA");
if(htmlhelp_HtmlHelpA==NULL) {
MessageBox(NULL,"Can't locate methods inside
hhctrl.ocx","Error",MB_OK);
exit(-1);
}
}
hope it works
Elias Pschernig
|