VB Creating A Program Questions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • recruitor2001
    New Member
    • Mar 2007
    • 8

    VB Creating A Program Questions

    Objective: To create a program that will allow the end user to input a number in terms of minutes and then click start. Once start has been selected a timer will start counting down from the the number they put into the textbox and once that number reaches zero it will delay for 5 seconds and then power down the computer.
    Comments: The last half of that is not as important as getting it to count down from a preselected number. I tried messing around with timers and threads and i just cant seem to get it... I would appreciate your help with this... also dont give me all of the answers, just point me in the right direction plz.

    http://i67.photobucket .com/albums/h303/recruitor/ShutdownTimer.j pg

    p.s. i attached a link to a pic of the form i made for the is program...
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Originally posted by recruitor2001
    Objective: To create a program that will allow the end user to input a number in terms of minutes and then click start. Once start has been selected a timer will start counting down from the the number they put into the textbox and once that number reaches zero it will delay for 5 seconds and then power down the computer.
    Comments: The last half of that is not as important as getting it to count down from a preselected number. I tried messing around with timers and threads and i just cant seem to get it... I would appreciate your help with this... also dont give me all of the answers, just point me in the right direction plz.

    http://i67.photobucket .com/albums/h303/recruitor/ShutdownTimer.j pg

    p.s. i attached a link to a pic of the form i made for the is program...
    Interesting. Is this a college assignment?

    Comment

    • vijaydiwakar
      Contributor
      • Feb 2007
      • 579

      #3
      Originally posted by recruitor2001
      Objective: To create a program that will allow the end user to input a number in terms of minutes and then click start. Once start has been selected a timer will start counting down from the the number they put into the textbox and once that number reaches zero it will delay for 5 seconds and then power down the computer.
      Comments: The last half of that is not as important as getting it to count down from a preselected number. I tried messing around with timers and threads and i just cant seem to get it... I would appreciate your help with this... also dont give me all of the answers, just point me in the right direction plz.

      http://i67.photobucket .com/albums/h303/recruitor/ShutdownTimer.j pg

      p.s. i attached a link to a pic of the form i made for the is program...
      dear for that use timer with interval of 1000 = 1 sec then decrement the no by one once its reached to 0 enable another timer in that timer after 5 seconds use following code
      Code:
      'In general section
      Const EWX_LOGOFF = 0
      Const EWX_SHUTDOWN = 1
      Const EWX_REBOOT = 2
      Const EWX_FORCE = 4
      Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
      Private Sub Form_Load()
          msg = MsgBox("This program is going to reboot your computer. Press OK to continue or Cancel to stop.", vbCritical + vbOKCancel + 256, App.Title)
          If msg = vbCancel Then End
          'reboot the computer
          ret& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
      End Sub

      Comment

      • recruitor2001
        New Member
        • Mar 2007
        • 8

        #4
        Originally posted by willakawill
        Interesting. Is this a college assignment?
        No, just a personal project.

        Comment

        • recruitor2001
          New Member
          • Mar 2007
          • 8

          #5
          Originally posted by vijaydiwakar
          dear for that use timer with interval of 1000 = 1 sec then decrement the no by one once its reached to 0 enable another timer in that timer after 5 seconds use following code
          Code:
          'In general section
          Const EWX_LOGOFF = 0
          Const EWX_SHUTDOWN = 1
          Const EWX_REBOOT = 2
          Const EWX_FORCE = 4
          Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
          Private Sub Form_Load()
              msg = MsgBox("This program is going to reboot your computer. Press OK to continue or Cancel to stop.", vbCritical + vbOKCancel + 256, App.Title)
              If msg = vbCancel Then End
              'reboot the computer
              ret& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
          End Sub
          Ummm, I dont know exactly what you were trying to say, if you could type it all out in code, I would appreciate it.

          Comment

          Working...