Shutdown windows 2000 from C# application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Madhava Patro

    #1

    Shutdown windows 2000 from C# application

    Hi All,

    I have a requirement where i have to Shutdown Windows 2000
    from a C# Application, my application is running as
    windows
    service.

    When I shutdown Windows it should not reboot again, It
    should power down.

    please help me to resolve this.

    Thanks,
    Madhava


  • José Joye

    #2
    Re: Shutdown windows 2000 from C# application

    Look there:

    Free software components for C#, VB.NET and other .NET languages.


    José

    "Madhava Patro" <mpatro@rudolph tech.com> a écrit dans le message de
    news:07c601c38c 48$28903820$a10 1280a@phx.gbl.. .[color=blue]
    > Hi All,
    >
    > I have a requirement where i have to Shutdown Windows 2000
    > from a C# Application, my application is running as
    > windows
    > service.
    >
    > When I shutdown Windows it should not reboot again, It
    > should power down.
    >
    > please help me to resolve this.
    >
    > Thanks,
    > Madhava
    >
    >[/color]


    Comment

    • Jeffrey Tan[MSFT]

      #3
      RE: Shutdown windows 2000 from C# application


      Hi Madhava,

      You can use .Net Pinvoke to interop with the Win32 API functions
      ExitWindowsEx to shut down the computer.
      Because your caller process must have SE_SHUTDOWN_NAM E privilege, you also
      should interop some API functions to adjust its privilege, such as
      AdjustTokenPriv ileges.

      For sample code, please refer to:
      http://msdn.microsoft.com/library/de...us/sysinfo/bas
      e/shutting_down.a sp

      Hope this helps,

      Best regards,
      Jeffrey Tan
      Microsoft Online Partner Support
      Get Secure! - www.microsoft.com/security
      This posting is provided "as is" with no warranties and confers no rights.

      --------------------
      | Content-Class: urn:content-classes:message
      | From: "Madhava Patro" <mpatro@rudolph tech.com>
      | Sender: "Madhava Patro" <mpatro@rudolph tech.com>
      | Subject: Shutdown windows 2000 from C# application
      | Date: Mon, 6 Oct 2003 13:26:44 -0700
      | Lines: 16
      | Message-ID: <07c601c38c48$2 8903820$a101280 a@phx.gbl>
      | MIME-Version: 1.0
      | Content-Type: text/plain;
      | charset="iso-8859-1"
      | Content-Transfer-Encoding: 7bit
      | X-Newsreader: Microsoft CDO for Windows 2000
      | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
      | Thread-Index: AcOMSCiNEf07b67 hTsiNgQ2OOR9JNg ==
      | Newsgroups: microsoft.publi c.dotnet.genera l
      | Path: cpmsftngxa06.ph x.gbl
      | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:110942
      | NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
      | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
      |
      | Hi All,
      |
      | I have a requirement where i have to Shutdown Windows 2000
      | from a C# Application, my application is running as
      | windows
      | service.
      |
      | When I shutdown Windows it should not reboot again, It
      | should power down.
      |
      | please help me to resolve this.
      |
      | Thanks,
      | Madhava
      |
      |
      |

      Comment

      Working...