Home All Groups Group Topic Archive Search About

Class_Terminate problem & Run-time error'424': Object required

Author
29 May 2005 9:52 PM
codekwez
Hi,

I have an Outlook addin written in VB6 that that is giving me an error
message box every time I close Outlook saying "Run-time error '424':
Object required.

It is code that I've inherited and have to fix, but I'm not sure what
is causing the problem. My investigation has led me to believe the
following might be causing it.

When the OnDisconnection event is called, two class variables of the
same type that were initialized at one point in the code are set to
Nothing. This invokes two calls to Class_Terminate. When
Class_Terminate is called for the first instance, it does the necessary
cleanup in the function and exits apporpriately. However when
Class_Terminate is called for the second variable, it never completes
it's cleanup because OnDisconnection reaches the end of the function
and exits the addin. And therefore I get the error message because the
objects are gone.

Does this seem plausible? Is there are way to ensure that the cleanup
routines can finish before the OnDisconnection exits (if this is the
problem)? Any suggestions?

Thanks.

Author
30 May 2005 2:26 PM
mr_unreliable
hi CodeKwez,

I have never had this experience, and it sounds ugly.

It sounds like the second instantiation cleanup (terminate code)
is proceeding A-synchronously, while the set obj = nothing is
completing.

As a "brute-force" type suggestion: if you have access to the
class code, I suggest adding a "clean-up" routine, which does the
same stuff as your class terminate code.

Then in the onDisconnect routine, explicitly call the "clean-up"
method.  That "should" not return until it has completed its
cleanup.

You may also need to add a (class level) flag, indicating that
the clean-up has already been completed, to avoid attempting to
do a second cleanup in the class terminate code.

cheers, jw
_______________________________________________________

You got questions?  WE GOT ANSWERS!!!  ..(but,
    no guarantee the answer will apply to your question)


codekwez wrote:
Show quoteHide quote
> Hi,
>
> I have an Outlook addin written in VB6 that that is giving me an error
> message box every time I close Outlook saying "Run-time error '424':
> Object required.
>
> It is code that I've inherited and have to fix, but I'm not sure what
> is causing the problem. My investigation has led me to believe the
> following might be causing it.
>
> When the OnDisconnection event is called, two class variables of the
> same type that were initialized at one point in the code are set to
> Nothing. This invokes two calls to Class_Terminate. When
> Class_Terminate is called for the first instance, it does the necessary
> cleanup in the function and exits apporpriately. However when
> Class_Terminate is called for the second variable, it never completes
> it's cleanup because OnDisconnection reaches the end of the function
> and exits the addin. And therefore I get the error message because the
> objects are gone.
>
> Does this seem plausible? Is there are way to ensure that the cleanup
> routines can finish before the OnDisconnection exits (if this is the
> problem)? Any suggestions?
>
> Thanks.
>
Author
30 May 2005 8:08 PM
Harry Strybos
Show quote Hide quote
"codekwez" <rebk***@gmail.com> wrote in message
news:1117403536.772706.278860@z14g2000cwz.googlegroups.com...
> Hi,
>
> I have an Outlook addin written in VB6 that that is giving me an error
> message box every time I close Outlook saying "Run-time error '424':
> Object required.
>
> It is code that I've inherited and have to fix, but I'm not sure what
> is causing the problem. My investigation has led me to believe the
> following might be causing it.
>
> When the OnDisconnection event is called, two class variables of the
> same type that were initialized at one point in the code are set to
> Nothing. This invokes two calls to Class_Terminate. When
> Class_Terminate is called for the first instance, it does the necessary
> cleanup in the function and exits apporpriately. However when
> Class_Terminate is called for the second variable, it never completes
> it's cleanup because OnDisconnection reaches the end of the function
> and exits the addin. And therefore I get the error message because the
> objects are gone.
>
> Does this seem plausible? Is there are way to ensure that the cleanup
> routines can finish before the OnDisconnection exits (if this is the
> problem)? Any suggestions?
>
> Thanks.
>
I'm just wondering if a DoEvents call might solve the problem? Just a
thought
Author
31 May 2005 8:35 AM
Jan Hyde
"codekwez" <rebk***@gmail.com>'s wild thoughts were released
on 29 May 2005 14:52:16 -0700 bearing the following fruit:

>Hi,
>
>I have an Outlook addin written in VB6 that that is giving me an error
>message box every time I close Outlook saying "Run-time error '424':
>Object required.

PLEASE DON'T MULIPOST!!!

J

Show quoteHide quote
>It is code that I've inherited and have to fix, but I'm not sure what
>is causing the problem. My investigation has led me to believe the
>following might be causing it.
>
>When the OnDisconnection event is called, two class variables of the
>same type that were initialized at one point in the code are set to
>Nothing. This invokes two calls to Class_Terminate. When
>Class_Terminate is called for the first instance, it does the necessary
>cleanup in the function and exits apporpriately. However when
>Class_Terminate is called for the second variable, it never completes
>it's cleanup because OnDisconnection reaches the end of the function
>and exits the addin. And therefore I get the error message because the
>objects are gone.
>
>Does this seem plausible? Is there are way to ensure that the cleanup
>routines can finish before the OnDisconnection exits (if this is the
>problem)? Any suggestions?
>
>Thanks.


Jan Hyde (VB MVP)

--
Alarms: What an octopus is  (Leopold Fechtner) 

[Abolish the TV Licence - http://www.tvlicensing.biz/]
Author
31 May 2005 8:18 PM
Harry Strybos
"Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message
news:pe8o915e48h4i9cr1g5tj92fs7r99mnt8n@4ax.com...
> "codekwez" <rebk***@gmail.com>'s wild thoughts were released
> on 29 May 2005 14:52:16 -0700 bearing the following fruit:
>
>>Hi,
>>
>>I have an Outlook addin written in VB6 that that is giving me an error
>>message box every time I close Outlook saying "Run-time error '424':
>>Object required.
>
> PLEASE DON'T MULIPOST!!!
>
Are you shouting at me? I didn't multi-post!
Author
1 Jun 2005 8:03 AM
Jan Hyde
"Harry Strybos" <harry_NOSPAM@ffapaysmart.com.au>'s wild
thoughts were released on Wed, 1 Jun 2005 06:18:31 +1000
bearing the following fruit:

Show quoteHide quote
>
>"Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message
>news:pe8o915e48h4i9cr1g5tj92fs7r99mnt8n@4ax.com...
>> "codekwez" <rebk***@gmail.com>'s wild thoughts were released
>> on 29 May 2005 14:52:16 -0700 bearing the following fruit:
>>
>>>Hi,
>>>
>>>I have an Outlook addin written in VB6 that that is giving me an error
>>>message box every time I close Outlook saying "Run-time error '424':
>>>Object required.
>>
>> PLEASE DON'T MULIPOST!!!
>>
>Are you shouting at me? I didn't multi-post!
>

No, look at my message

"codekwez" <rebk***@gmail.com>'s wild thoughts were released

I was shouting at him (her) because I'd started to help in
another group.



Jan Hyde (VB MVP)

--
Artifacts: Information on painters (Jonathan Delaney)

[Abolish the TV Licence - http://www.tvlicensing.biz/]
Author
8 Jun 2005 2:44 PM
codekwez
Jad,

I apologize for the multipost, I am new to posting on this groups and
was unaware that the same people monitor different groups.  I've seen
other people post a question to numerous groups and thought it was a
standard.  Thanks for trying to help out.

-E
Author
8 Jun 2005 2:52 PM
Ken Halter
"codekwez" <rebk***@gmail.com> wrote in message
news:1118241840.710979.16270@g43g2000cwa.googlegroups.com...
> Jad,
>
> I apologize for the multipost, I am new to posting on this groups and
> was unaware that the same people monitor different groups.  I've seen
> other people post a question to numerous groups and thought it was a
> standard.  Thanks for trying to help out.
>
> -E

If you add all target groups to the "Newsgroups" line at once (crosspost
instead of multipost), exactly like sending email to several people, the
question will show in multiple groups but all answers/replies, no matter
which group they originated from, will stay "connected" to a single thread.
Posting a question to each group, one at a time doesn't work that way. It
starts several, completely separate threads. Multiposting (vs crossposting)
makes it harder on everyone involved.


--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..