Timing... plz help?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Timing... plz help?

  1. #1
    Join Date
    Oct 2002
    Posts
    6

    Timing... plz help?

    k i have a webserver set up right now and i was wondering if it would be possibleto make a program that runs at the bottom of the sceen just minimized that will for example close the server at 4:30 am, then restart it at 4:33 am, there are paths for the webserver that start it and stop it :

    start : c:/phpdev/phpdev_start.bat
    stop : c:/phpdev/phpdev_stop.bat

    is there a way to set it up so it runs by the system clock or somehting?

    plz help

    thanks

  2. #2
    Join Date
    Apr 2002
    Posts
    388
    To start and stop the application you could use the shell function. The Application could always be in the Taskbar by setting WindowsState to vbminimized and handling the resize event of the form and set there the windowstate to vbminimized.

    I dont know how to do the things to specific times.

    Hope I could help you.
    mfg Ungi

    Music, music and VB. VB is like music: You never know how it is interpreted.

  3. #3
    Join Date
    Jun 2002
    Location
    Bolton, UK
    Posts
    55

    time

    Do
    If Time = #4:30:00 AM# Then
    Shell "c:/phpdev/phpdev_start.bat"
    End If
    DoEvents
    Loop

  4. #4
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167
    The example from Kangolian will work except the CPU usage will go up to 100% (and yes it does not cause the system to hang as the DOEVENTS takes care of that).

    Another way is to use TIMER control and set it to go off every minute and check the time when the timer triggers and execute your logic accordingly.

    -Cool Bizs

  5. #5
    Join Date
    Sep 2001
    Location
    Québec, Canada
    Posts
    1,922
    And do not use that kind of IF:

    Code:
    If TimeNow = TimeToStart Then
    Use something more like:

    Code:
    If TimeNow >= TimeToStart Then
    You want it to start event if there is some seconds in more. In that case, you must make sure that the server is not started before starting it, because the condition will be always true

    JeffB
    CodeGuru VB FAQ Visual Basic Frequently Asked Questions
    VB Code color Tool to color your VB code on CodeGuru
    Before you post Importants informations to know before posting

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center