hi everyone i need a little help, im trying to create a program which ask a user a password and when it reached a max password retry it goes to windows login. when he enters the right windows login my app will try to ask again. until the correct password is given.

does anyone knows or have an idea on how to do this? thanks a lot

10 Years
Discussion Span
Last Post by Kerjo

what is the reasoning behind booting someone to the login screen if they dont know the password to an application?


Not a smart idea, and an easy way to get into a legal jam if the forced logout causes loss of data in another application.
But, if you inisit on this insanity, you could register your application to restart in the registry, then call the Win API call to force Logout which will bring up the login screen (THAT IS IF... The PC is setup to require a login). The force Logout will close all other user processes and applicaitons on its way down.

Be careful what you wish for.


Are you wanting to just lock the workstation, rather than log the user out? If so, you can do this somewhere in your class:

public static extern void LockWorkStation();

And then just called LockWorkStation() like any other method.

I wouldn't suggest forcing a logout like other said, so give this a shot.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.