Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

timer?

Posted on 1998-08-03
7
Medium Priority
?
152 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 

Expert Comment

by:vinoopauls
ID: 1467619
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
ID: 1467620
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
ID: 1467621
(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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

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

Author Comment

by:brohans
ID: 1467623
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
ID: 1467624
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 100 total points
ID: 1467625


     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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

647 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