Thanks Mark,
That was one I had already tried!
The command works fine from a console window, but not from a Windows
Service. For example:
HINSTANCE x = ShellExecute(NULL, NULL, "rundll32.exe",
"user32.dll,LockWorkStation", NULL, 0);
returns x = 42, which indicates success. However, the workstation is not
locked.
It looks like a security problem of some sort (I've tried running the
service as Local Server and a Remote Service too, but there is no change)
Regards
Ben
"Mark L. Ferguson" wrote:
> Use this command : %windir%\System32\rundll32.exe user32.dll,LockWorkStation
>
> --
> Was this helpful? Then click the Ratings button. Voting helps the web
> interface.
> http://www.microsoft.com/wn3/locales...eAPostAsAnswer
> Mark L. Ferguson
> .
>
> "Malignonne" <> wrote in message
> news:E76079B5-90B2-4724-AB55-...
> > Hello,
> > I have written a Credential Provider which requires a secure token to be
> > present. This works fine. I have written a Windows Service which
> > periodically
> > scans for the secure token presence. This works fine.
> >
> > HOWEVER ....
> >
> > What I would like to be able to do is to lock the workstation (go back to
> > the logon screen) if my Windows Service notices that the secure token is
> > no
> > longer present.
> >
> > How can I do this (I've been trawling through the web and haven't found
> > anything I can use).
> >
> > I've tried running the Windows Service both as a User and as a
> > LocalService.
> >
> > Any suggestions would be very gratefully received!
>