We help IT Professionals succeed at work.

Synchronize sound w/VB6 form

wjshore asked
Last Modified: 2013-12-26
I'm working in VB6.  I need to synchronize the playing of a sound with a condition on a form.  The condition is whether or not an image is visible .  The problem is this;  When I evaluate for the condition, it's being done on one of the form's 'prep' events (load, initialize, paint, etc - I've tried lots).  Thus, the sound plays before the form is fully displayed.  Is there a way the form can completely display and then raise an event which evaluates the image (visible or not) and THEN plays the sound?
Watch Question


Ive used a single timer control to delay reprocessing a form (after user selection) until it has finished displaying.

it's interval is set to 50 milliseconds.

Private Sub cboHighlight_check()
    'routine to detect change of phase
    If cboHighlight.ListIndex <> mHighlightId Then
        mHighlightId = cboHighlight.ListIndex
        tmrPhaseChange.Enabled = True
    End If
End Sub

the timer then fires and form contents get redrawn.
Unlock this solution and get a sample of our free trial.
(No credit card required)
aikimarkSocial distance; Wear a mask; Don't touch your face; Wash your hands for 20 seconds
Top Expert 2014

put your code in the Activate event.
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009

"Is there a way the form can completely display..."

Here is how to make the form show itself before continuing with the rest of the Load event:

Private Sub Form_Load()
    ' force the form to show itself
    ' continue doing other stuff...
End Sub

>>"Here is how to make the form show itself before continuing with the rest of the Load event:"

As long as it's not been shown modally elsewhere, e.g., that will fail if elsewhere *this* form's being implicitly loaded via, say, someForm.Show vbModal

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.