|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Class_Terminate problem & Run-time error'424': Object requiredI 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. 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. >
Show quote
Hide quote
"codekwez" <rebk***@gmail.com> wrote in message I'm just wondering if a DoEvents call might solve the problem? Just a 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. > thought "codekwez" <rebk***@gmail.com>'s wild thoughts were released on 29 May 2005 14:52:16 -0700 bearing the following fruit:>Hi, PLEASE DON'T MULIPOST!!!> >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. J Show quoteHide quote >It is code that I've inherited and have to fix, but I'm not sure what Jan Hyde (VB MVP)>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. -- Alarms: What an octopus is (Leopold Fechtner) [Abolish the TV Licence - http://www.tvlicensing.biz/] "Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message Are you shouting at me? I didn't multi-post!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!!! > "Harry Strybos" <harry_NOSPAM@ffapaysmart.com.au>'s wild thoughts were released on Wed, 1 Jun 2005 06:18:31 +1000bearing the following fruit: Show quoteHide quote > No, look at my message>"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! > "codekwez" <rebk***@gmail.com>'s wild thoughts were released I was shouting at him (her) because I'd started to help inanother group. Jan Hyde (VB MVP) -- Artifacts: Information on painters (Jonathan Delaney) [Abolish the TV Licence - http://www.tvlicensing.biz/] 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 "codekwez" <rebk***@gmail.com> wrote in message If you add all target groups to the "Newsgroups" line at once (crosspost 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 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.. |
|||||||||||||||||||||||