Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6865389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:02:27+00:00 2026-05-27T03:02:27+00:00

I am working with a proprietary VB6 COM library. The library has some functions

  • 0

I am working with a proprietary VB6 COM library. The library has some functions which fire and I get the results once complete through Events.

Container Class:

Private WithEvents myObj As proprietaryObj
Public status as Integer
Set myObj = new proprietaryObj
status = 1
Call myObj.DoIt1()

...

' Call back event function
Private Sub myObj_Done(ByVal Code As Long)
    ...
    MsgBox "Finished"
    status = 2
End Sub

So everything works well (verified). What I want to do is encapsulate the above code + more in a class, so that I wrap multiple functions which need to stack, or get executed consecutively after a successful callback report.

So I went ahead and did this:

Call myObj.DoIt1()
Do
    If myObj.Status = 2 Then Exit Do
    If myObj.Status = -1 Then Exit Do 'Error
    DoEvents
Loop
call myObj.DoIt2()

I get the “Finished” dialog box, but DoIt2 never fires. In fact, if I pause my code while running debug after I see the “Finished” message, the code is currently executing the DoEvents, and the myObj.Status = 1 as if it were never touched.

It almost seems as if a different instance of the object was created for a separate thread? How do I safely and correctly wait for the event callback to fire before continuing execution with the next DoIt2() ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:02:27+00:00Added an answer on May 27, 2026 at 3:02 am

    You need to use your local status variable, because that is what you are setting to 2:

    Call myObj.DoIt1()
    Do
        If status = 2 Then Exit Do
        If status = -1 Then Exit Do 'Error
        DoEvents
    Loop
    call myObj.DoIt2()
    

    Else you could also try to set status = 2 before the call to MsgBox "Finished".

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my app, which uses a proprietary bluetooth device, I'm working on self-correcting some
I am working with a 3rd party proprietary library (no source code) which creates
Working with python interactively, it's sometimes necessary to display a result which is some
I'm working with a certain external server product which happens to be proprietary. However,
I'm working on a project that has a proprietary file format. The project has
I'm working with a client's proprietary ASP.NET app, to which we added a PHP
I'm working on a proprietary site, and I'm having some issues. I'm using jQuery
I'm currently working on a project that utilizes a proprietary PCMCIA radio card to
Initial situation: I am working with a proprietary framework ( ESRI 's ArcGIS Engine
I'm working on a Rails application which I've set up locally on my OSX

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.