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

Dont think it can be done easialy.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.