Solved

timer?

Posted on 1998-08-03
7
142 Views
Last Modified: 2010-05-03
i need to turn on a animation..i mean play an avi for some time like 5 secs
and turn it off after that....the avi will play only when the user clicks the start button
how do i do this in vb?
0
Comment
Question by:brohans
  • 3
  • 2
  • 2
7 Comments
 

Expert Comment

by:vinoopauls
Comment Utility
Try this code:

   At design time set timer1.enabled=false
                              timer1.interval=5000

Private Sub Command1_Click()
    Timer1.Enabled = True
'  Play the AVI
End Sub

Private Sub Timer1_Timer()
'  Stop the AVI
Timer1.Enabled = False
End Sub

0
 

Author Comment

by:brohans
Comment Utility
how do i play the animation before i show a form?
the animation must play for a while before the form is shown e.g.
as i click on the start button..the animation plays ..then the form shows

i used the code above and did not work..
the animation does not play before the form is shown..

0
 
LVL 18

Expert Comment

by:deighton
Comment Utility
(declarations)

bEnd as boolean

Private Sub Form_Initialise()
         Timer1.Interval = 5000
         Timer1.Enabled = True
         bEnd = false      
     '  Play the AVI  here

          while not(bEnd)
          wend


     End Sub

     Private Sub Timer1_Timer()
     '  Stop the AVI here
        Timer1.Enabled = False
        bEnd = true
     End Sub
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Expert Comment

by:vinoopauls
Comment Utility
But where is this start button??
That has to be on some form. put the timer on that form
0
 

Author Comment

by:brohans
Comment Utility
i tried yr method
and it hang my pc probably
due to the
while loop that u suggest above...
can u correct it?
0
 

Author Comment

by:brohans
Comment Utility
i tried yr method
and it hang my pc probably
due to the
while loop that u suggest above...
can u correct it?
0
 
LVL 18

Accepted Solution

by:
deighton earned 50 total points
Comment Utility


     bEnd as boolean

     Private Sub Form_Initialise()
              Timer1.Interval = 5000
              Timer1.Enabled = True
              bEnd = false        
          '  Play the AVI  here

               while not(bEnd)
                     DoEvents               'Sorry forgot this vital bit
               wend


          End Sub

          Private Sub Timer1_Timer()
          '  Stop the AVI here
             Timer1.Enabled = False
             bEnd = true
          End Sub





0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now