Switch user/Login (Vista)
Posted: Thu Jan 31, 2008 11:54 am
Hi all,
(Background)
I'm currently running Vista with two accounts, an Admin and Standard - I work as a Standard, but where I'm configuring my new lappy, I'm finding myself having to jump back and forth between accounts. I'm trying to put together a little "User-switcher" button that'll drop me straight into the Admin account (or at least to the "Enter Password" dialog)
(Problem)
Having searched high and low, I cannot find a "login" API anywhere. I cannot believe it doesn't exist somewhere, but google, MSDN, forums search have produces nothing my wild goose-chases so far
I've worked out the code to log off, but this only dumps me out as far as the "Choose an account" screen... I'd like to try to get a bit further because Click [>] -> *Switch User* -> *Choose account* -> *Enter password* is both clunky, slow and annoying.
Here's the code I've got so far... Maybe I'm looking in the wrong direction!
Now I know I could Run As Administrator for a lot of things, but I "BossKey"-type solution would be far more helpful.
Can anyone point me in the right direction? Thanks in advance!
(Background)
I'm currently running Vista with two accounts, an Admin and Standard - I work as a Standard, but where I'm configuring my new lappy, I'm finding myself having to jump back and forth between accounts. I'm trying to put together a little "User-switcher" button that'll drop me straight into the Admin account (or at least to the "Enter Password" dialog)
(Problem)
Having searched high and low, I cannot find a "login" API anywhere. I cannot believe it doesn't exist somewhere, but google, MSDN, forums search have produces nothing my wild goose-chases so far
I've worked out the code to log off, but this only dumps me out as far as the "Choose an account" screen... I'd like to try to get a bit further because Click [>] -> *Switch User* -> *Choose account* -> *Enter password* is both clunky, slow and annoying.
Here's the code I've got so far... Maybe I'm looking in the wrong direction!
Code: Select all
#LIBRARY = 0
If OpenLibrary(#LIBRARY, "WtsApi32.dll")
CallFunction(#LIBRARY, "WTSDisconnectSession", 0, -1, false)
CloseLibrary(#LIBRARY)
EndIf
Can anyone point me in the right direction? Thanks in advance!