🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages Started by JB Tue, 15 Apr 2008 14:57
HtmlHelp out of resources problem
#440
Author: JB
Date: Tue, 15 Apr 2008 14:57
50 lines
2173 bytes
Hi,

I am converting my application from using WinHelp to HtmlHelp.  
I have mostly got it working, but have a problem which I don�t 
understand.

My application has a main form which is always open and 
serveral other forms which can be opened from the main form, 
but in most cases only one of these additional forms can be 
open at one time.

In the set up of my main form I do the following:

HINSTANCE hHtmlHelpModule = LoadLibrary("hhctrl.ocx");

 //Get the address of the HtmlHelpA API.
 HtmlHelpFunction = (HTMLHELP)::GetProcAddress
                            (hHtmlHelpModule, "HtmlHelpA");

On most of the forms, to display the help to the user I do the 
following:

HWND hWnd;

    if (MainForm->HtmlHelpFunction)
    {
        MainForm->HelpFilename = HELPFILENAME;
        (*MainForm->HtmlHelpFunction)(hWnd, MainForm-
               >HelpFilename.c_str(), HH_HELP_CONTEXT, IDH_E1);
    }

and this works fine.

In one case I open several additional forms at once and with 
the same code I get an out of resources error message.

If instead I use the following:

    if (MainForm->HtmlHelpFunction)
    {
        MainForm->HelpFilename = HELPFILENAME;
        (*MainForm->HtmlHelpFunction)(Handle, MainForm-
         >HelpFilename.c_str(), HH_HELP_CONTEXT, IDH_E1);
    }

I don�t understand why and don�t know if the second piece of 
code is valid to use.
Any help would be appreciated.
JB
Re: HtmlHelp out of resources problem
#441
Author: Bob Gonder
Date: Tue, 15 Apr 2008 19:41
19 lines
1485 bytes
JB wrote:

>HWND hWnd;
>        (*MainForm->HtmlHelpFunction)(hWnd, MainForm-

What is the value of hWnd?
Seems to be random.

>If instead I use the following:
>
>        (*MainForm->HtmlHelpFunction)(Handle, MainForm-

And Handle is...?
I think the first parameter is meant to be
the handle of the current window, or at least,
the window that will handle or modify the internal help clicks.

You might want to use 0 for that if you have no need to track the help.
http://msdn2.microsoft.com/en-us/library/aa164218.aspx
Re: HtmlHelp out of resources problem
#445
Author: JB
Date: Wed, 16 Apr 2008 07:59
29 lines
1799 bytes
Bob Gonder <notbg@notmindspring.invalid> wrote:
>>HWND hWnd;
>>        (*MainForm->HtmlHelpFunction)(hWnd, MainForm-
>
>What is the value of hWnd?
>Seems to be random.
>
>>If instead I use the following:
>>
>>        (*MainForm->HtmlHelpFunction)(Handle, MainForm-
>
>And Handle is...?
>I think the first parameter is meant to be
>the handle of the current window, or at least,
>the window that will handle or modify the internal help clicks.

I guess it's the result of trying to use something that I 
didn't fully understand!  Yes the first parameter is the 
handle of the current (calling) window and is used to return 
focus to that window when the help file is closed.

Again you are right - I was trying to use hWnd unitinitalised, 
presumably it was luck that it worked at all.

Handle is however a property of TForm, so I guess this is the 
correct thing to use in this instance?

JB
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads