Results 1 to 6 of 6

Thread: [RESOLVED] [2008] When I press the restart button on my pc, my code doesn't detect it...

  1. #1

    Thread Starter
    Frenzied Member Icyculyr's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    1,934

    Resolved [RESOLVED] [2008] When I press the restart button on my pc, my code doesn't detect it...

    Hey, I've found that when I press the restart button on my pc (near the shutdown button, that my code for detecting shutdown doesn't work...

    Although it works if I click restart, log off, shutdown, via the Start menu,

    It just seems to not work?

    Code:
    Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        AddHandler Microsoft.Win32.SystemEvents.SessionEnding, AddressOf Shutdown
    End Sub
    
    Private Sub Shutdown(ByVal sender As Object, ByVal e As Microsoft.Win32.SessionEndingEventArgs)
        Using sw As New StreamWriter(My.Computer.FileSystem.SpecialDirectories.Desktop & "\RUNS.txt")
        End Using
    End Sub
    Does anyone know why?

    Thanks
    Icyculyr

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2008] When I press the restart button on my pc, my code doesn't detect it...

    How does your Restart work? Does it do a cold boot or does it invoke the shutdown process first?

  3. #3

    Thread Starter
    Frenzied Member Icyculyr's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    1,934

    Re: [2008] When I press the restart button on my pc, my code doesn't detect it...

    I have no idea, I click the button, and instant restart, no matter what's happening, so I'd guess it's a "cold boot"

    Cheers
    Icyculyr

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2008] When I press the restart button on my pc, my code doesn't detect it...

    Since it's instant, your application will not be able to detect it. The shutdown detection only works as part of the OS process.

  5. #5

    Thread Starter
    Frenzied Member Icyculyr's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    1,934

    Re: [2008] When I press the restart button on my pc, my code doesn't detect it...

    Ah ok, zthanks

    Cheers
    Icyculyr

  6. #6
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: [RESOLVED] [2008] When I press the restart button on my pc, my code doesn't detect it...

    I see the specs for your machine, but who made it?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

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



Click Here to Expand Forum to Full Width