logoff command - C++ console

Posted on 2006-04-27
Last Modified: 2013-12-03
hi experts,

What is the command to logoff current account in windwos XP?
Question by:ALNMOO
    LVL 11

    Accepted Solution

    hi try:

    ExitWindowsEx(EWX_LOGOFF, 0);
    LVL 8

    Expert Comment

    or use the shell command:

    shutdown -l

    (thats an L btw..)

    LVL 11

    Expert Comment

    to use the shell command you can use

    ShellExecute(NULL, "open" "shutdown.exe", "-l", 0, SW_SHOW);
    LVL 7

    Author Comment

    This what is worked with me:

    ExitWindowsEx(EWX_LOGOFF | EWX_FORCE, 0);


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (, we saw how to put the Delete button back there where it belongs.  "Delete" is …
    With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now