Home All Groups Group Topic Archive Search About

The GPF in VB6 Environment is caused by: Call HtmlHelp(Me.hwnd, App.HelpFile, HH_CLOSE_ALL, 0&)

Author
4 Jun 2009 2:36 PM
MM
Further to my earlier post re setting object vars to Nothing (see
thread "When and where do I set m_FormVar = Nothing"), I have now
found the cause of the GPF that is occurring in the VB6 environment
when Eudora Mail is loaded after I've run a particular VB6 app.

This happens when I run my app in the VB6 environment, exit the app
(but keep the env loaded), then run Eudora Mail. An immediate GPF
occurs in either USER.EXE or KRNL386.EXE.

I have now narrowed down the cause to the line:

Call HtmlHelp(Me.hwnd, App.HelpFile, HH_CLOSE_ALL, 0&)

which is in the Form_Unload event. If I comment out this line, the GPF
no longer occurs. I have replicated the cause and the fix ten times in
a row, so it's definitely that line that is at fault.

Any hints as to why?

Thanks!

(BTW, I only changed from WinHelp because it's not supported on later
op systems.)

MM

Author
4 Jun 2009 2:52 PM
Nobody
Show quote Hide quote
"MM" <kylix***@yahoo.co.uk> wrote in message
news:0rlf2519527096c890rha2vp0p68gte8m9@4ax.com...
> Further to my earlier post re setting object vars to Nothing (see
> thread "When and where do I set m_FormVar = Nothing"), I have now
> found the cause of the GPF that is occurring in the VB6 environment
> when Eudora Mail is loaded after I've run a particular VB6 app.
>
> This happens when I run my app in the VB6 environment, exit the app
> (but keep the env loaded), then run Eudora Mail. An immediate GPF
> occurs in either USER.EXE or KRNL386.EXE.
>
> I have now narrowed down the cause to the line:
>
> Call HtmlHelp(Me.hwnd, App.HelpFile, HH_CLOSE_ALL, 0&)
>
> which is in the Form_Unload event. If I comment out this line, the GPF
> no longer occurs. I have replicated the cause and the fix ten times in
> a row, so it's definitely that line that is at fault.
>
> Any hints as to why?
>
> Thanks!
>
> (BTW, I only changed from WinHelp because it's not supported on later
> op systems.)

See:

BUG: A Fatal Error Occurs If You Run a Microsoft Visual Basic Application by
Using the HtmlHelp API
http://support.microsoft.com/kb/244140
Author
4 Jun 2009 3:08 PM
MM
Show quote Hide quote
On Thu, 4 Jun 2009 10:52:24 -0400, "Nobody" <nob***@nobody.com> wrote:

>"MM" <kylix***@yahoo.co.uk> wrote in message
>news:0rlf2519527096c890rha2vp0p68gte8m9@4ax.com...
>> Further to my earlier post re setting object vars to Nothing (see
>> thread "When and where do I set m_FormVar = Nothing"), I have now
>> found the cause of the GPF that is occurring in the VB6 environment
>> when Eudora Mail is loaded after I've run a particular VB6 app.
>>
>> This happens when I run my app in the VB6 environment, exit the app
>> (but keep the env loaded), then run Eudora Mail. An immediate GPF
>> occurs in either USER.EXE or KRNL386.EXE.
>>
>> I have now narrowed down the cause to the line:
>>
>> Call HtmlHelp(Me.hwnd, App.HelpFile, HH_CLOSE_ALL, 0&)
>>
>> which is in the Form_Unload event. If I comment out this line, the GPF
>> no longer occurs. I have replicated the cause and the fix ten times in
>> a row, so it's definitely that line that is at fault.
>>
>> Any hints as to why?
>>
>> Thanks!
>>
>> (BTW, I only changed from WinHelp because it's not supported on later
>> op systems.)
>
>See:
>
>BUG: A Fatal Error Occurs If You Run a Microsoft Visual Basic Application by
>Using the HtmlHelp API
>http://support.microsoft.com/kb/244140

Ah! Interesting, thanks.

I've also fixed the problem by prefixing the call with

If m_HelpFileOpened Then ....

That is, now the line reads:

If m_HelpFileOpened Then Call HtmlHelp(Me.hwnd, App.HelpFile,
HH_CLOSE_ALL, 0&)

whereas before the line was being executed in Form_Unload irrespective
of whether Help had actually been invoked.

Fixed!

MM
Author
4 Jun 2009 3:10 PM
MikeD
Show quote Hide quote
"Nobody" <nob***@nobody.com> wrote in message news:uel%23aQS5JHA.972@TK2MSFTNGP06.phx.gbl...
> "MM" <kylix***@yahoo.co.uk> wrote in message news:0rlf2519527096c890rha2vp0p68gte8m9@4ax.com...
>> Further to my earlier post re setting object vars to Nothing (see
>> thread "When and where do I set m_FormVar = Nothing"), I have now
>> found the cause of the GPF that is occurring in the VB6 environment
>> when Eudora Mail is loaded after I've run a particular VB6 app.
>>
>> This happens when I run my app in the VB6 environment, exit the app
>> (but keep the env loaded), then run Eudora Mail. An immediate GPF
>> occurs in either USER.EXE or KRNL386.EXE.
>>
>> I have now narrowed down the cause to the line:
>>
>> Call HtmlHelp(Me.hwnd, App.HelpFile, HH_CLOSE_ALL, 0&)
>>
>> which is in the Form_Unload event. If I comment out this line, the GPF
>> no longer occurs. I have replicated the cause and the fix ten times in
>> a row, so it's definitely that line that is at fault.
>>
>> Any hints as to why?
>>
>> Thanks!
>>
>> (BTW, I only changed from WinHelp because it's not supported on later
>> op systems.)
>
> See:
>
> BUG: A Fatal Error Occurs If You Run a Microsoft Visual Basic Application by Using the HtmlHelp API
> http://support.microsoft.com/kb/244140
>


No need to use the add-in though.  Just call HtmlHelp passing HH_INITIALIZE/HH_UNINITIALIZE. Here are the declarations:

Private Const HH_INITIALIZE = &H1C ' Initializes the help system.
Private Const HH_UNINITIALIZE = &H1D ' Uninitializes the help system.


--
Mike
Author
4 Jun 2009 6:41 PM
MM
Show quote Hide quote
On Thu, 4 Jun 2009 11:10:25 -0400, "MikeD" <nob***@nowhere.edu> wrote:

>
>"Nobody" <nob***@nobody.com> wrote in message news:uel%23aQS5JHA.972@TK2MSFTNGP06.phx.gbl...
>> "MM" <kylix***@yahoo.co.uk> wrote in message news:0rlf2519527096c890rha2vp0p68gte8m9@4ax.com...
>>> Further to my earlier post re setting object vars to Nothing (see
>>> thread "When and where do I set m_FormVar = Nothing"), I have now
>>> found the cause of the GPF that is occurring in the VB6 environment
>>> when Eudora Mail is loaded after I've run a particular VB6 app.
>>>
>>> This happens when I run my app in the VB6 environment, exit the app
>>> (but keep the env loaded), then run Eudora Mail. An immediate GPF
>>> occurs in either USER.EXE or KRNL386.EXE.
>>>
>>> I have now narrowed down the cause to the line:
>>>
>>> Call HtmlHelp(Me.hwnd, App.HelpFile, HH_CLOSE_ALL, 0&)
>>>
>>> which is in the Form_Unload event. If I comment out this line, the GPF
>>> no longer occurs. I have replicated the cause and the fix ten times in
>>> a row, so it's definitely that line that is at fault.
>>>
>>> Any hints as to why?
>>>
>>> Thanks!
>>>
>>> (BTW, I only changed from WinHelp because it's not supported on later
>>> op systems.)
>>
>> See:
>>
>> BUG: A Fatal Error Occurs If You Run a Microsoft Visual Basic Application by Using the HtmlHelp API
>> http://support.microsoft.com/kb/244140
>>
>
>
>No need to use the add-in though.  Just call HtmlHelp passing HH_INITIALIZE/HH_UNINITIALIZE. Here are the declarations:
>
>Private Const HH_INITIALIZE = &H1C ' Initializes the help system.
>Private Const HH_UNINITIALIZE = &H1D ' Uninitializes the help system.

Right-o, I'll take a look at that, too. BTW, this GPF side effect only
affects the design environment, yes? I haven't yet had any problem
with the compiled app.

MM
Author
4 Jun 2009 8:30 PM
MikeD
"MM" <kylix***@yahoo.co.uk> wrote in message news:d95g25ll6tdve01qr80u4n6a3qv8kna2ta@4ax.com...
>>
>>
>>No need to use the add-in though.  Just call HtmlHelp passing HH_INITIALIZE/HH_UNINITIALIZE. Here are the declarations:
>>
>>Private Const HH_INITIALIZE = &H1C ' Initializes the help system.
>>Private Const HH_UNINITIALIZE = &H1D ' Uninitializes the help system.
>
> Right-o, I'll take a look at that, too. BTW, this GPF side effect only
> affects the design environment, yes? I haven't yet had any problem
> with the compiled app.
>


To be honest, I'm not sure.  But I've always made the calls to HtmlHelp to be safe.

--
Mike