Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to use ExitWindowsEx function in C#

How to use ExitWindowsEx function in C#

Scheduled Pinned Locked Moved C#
csharptutorial
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    largs
    wrote on last edited by
    #1

    Please show me how to call ExitWindowsEx function in user32.dll in .NET.I've tried this: [DllImport("user32.dll")] private static extern int ExitWindowsEx(int dwReserved, int uReturnCode ); public static void Main() { ExitWindowsEx(0,0) } This previous code can log off the computer but when i change it to ExitWindowsEx(1,0) nothing happen.i dont understand clearly about these parameters's meanings.So please explain more clearly for me.Tnx lots

    R M 2 Replies Last reply
    0
    • L largs

      Please show me how to call ExitWindowsEx function in user32.dll in .NET.I've tried this: [DllImport("user32.dll")] private static extern int ExitWindowsEx(int dwReserved, int uReturnCode ); public static void Main() { ExitWindowsEx(0,0) } This previous code can log off the computer but when i change it to ExitWindowsEx(1,0) nothing happen.i dont understand clearly about these parameters's meanings.So please explain more clearly for me.Tnx lots

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      The calling process requires the SE_SHUTDOWN_NAME privilege in order to shutdown the system. Also see InitiateSystemShutdownEx()[^]. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

      1 Reply Last reply
      0
      • L largs

        Please show me how to call ExitWindowsEx function in user32.dll in .NET.I've tried this: [DllImport("user32.dll")] private static extern int ExitWindowsEx(int dwReserved, int uReturnCode ); public static void Main() { ExitWindowsEx(0,0) } This previous code can log off the computer but when i change it to ExitWindowsEx(1,0) nothing happen.i dont understand clearly about these parameters's meanings.So please explain more clearly for me.Tnx lots

        M Offline
        M Offline
        minhpc_bk
        wrote on last edited by
        #3

        Hi there, While you want to get help from CodeProject, but your username can make people here really annoyed, it's not polite :( (or do you think people don't know Vietnamese?)

        N 1 Reply Last reply
        0
        • M minhpc_bk

          Hi there, While you want to get help from CodeProject, but your username can make people here really annoyed, it's not polite :( (or do you think people don't know Vietnamese?)

          N Offline
          N Offline
          Nish Nishant
          wrote on last edited by
          #4

          minhpc_bk wrote:

          (or do you think people don't know Vietnamese?)

          :confused: Regards, Nish

          My blog : Nish’s thoughts on MFC, C++/CLI and .NET

          M 1 Reply Last reply
          0
          • N Nish Nishant

            minhpc_bk wrote:

            (or do you think people don't know Vietnamese?)

            :confused: Regards, Nish

            My blog : Nish’s thoughts on MFC, C++/CLI and .NET

            M Offline
            M Offline
            minhpc_bk
            wrote on last edited by
            #5

            Hi Nish, You probably get shocked when you know what his id means in English. It's currently in Vnese, and in English it means "f*ck your mom" ! However, I think he might be joking when he picked up this id for himself.

            L N 2 Replies Last reply
            0
            • M minhpc_bk

              Hi Nish, You probably get shocked when you know what his id means in English. It's currently in Vnese, and in English it means "f*ck your mom" ! However, I think he might be joking when he picked up this id for himself.

              L Offline
              L Offline
              largs
              wrote on last edited by
              #6

              HI all.I'm really sorry.I dont mean that because i'm not vnese and i dont understand its meaning.I've changed it already.However pls help me with this problem

              M 1 Reply Last reply
              0
              • L largs

                HI all.I'm really sorry.I dont mean that because i'm not vnese and i dont understand its meaning.I've changed it already.However pls help me with this problem

                M Offline
                M Offline
                minhpc_bk
                wrote on last edited by
                #7

                You can check out the ExitWindowsEx[^] function in the Platform SDK for the meaning of the parameter. You can also find the sample code from here: + http://www.pinvoke.net/default.aspx/user32/ExitWindowsEx.html[^] + http://blogs.msdn.com/brad_mccabe/archive/2005/03/02/383542.aspx[^]

                1 Reply Last reply
                0
                • M minhpc_bk

                  Hi Nish, You probably get shocked when you know what his id means in English. It's currently in Vnese, and in English it means "f*ck your mom" ! However, I think he might be joking when he picked up this id for himself.

                  N Offline
                  N Offline
                  Nish Nishant
                  wrote on last edited by
                  #8

                  minhpc_bk wrote:

                  You probably get shocked when you know what his id means in English. It's currently in Vnese, and in English it means "f*ck your mom" ! However, I think he might be joking when he picked up this id for himself.

                  Egad! That is bad!!! Regards, Nish

                  My blog : Nish’s thoughts on MFC, C++/CLI and .NET

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups