I 've been using LockWorkstation API to lock the workstation, however this only works in my Windows 7 laptop.
In my Win 8.1 desktop, this function does nothing. Can I go programmatically to the "switch user" screen?
Thanks.
You can display the "switch user" screen with the following code:
WTSDisconnectSession(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, FALSE);
Note that WTSDisconnectSession is only available for Vista and up, so if you need XP compatibility you would have to use GetProcAddress rather than calling the function directly.
Related
I want to create a program for a computer lab. The computers in lab are running Windows 7 and are connected via LAN. The program should freeze keyboard and mouse when PC gets disconnected from LAN and also show a fullscreen message.
Currently I have created the first version of this program that works almost fine. It runs with startup. But the problem is that the users can kill it from Task Manager. I've tried running it as a windows service and it runs but cannot interact with desktop, so it cannot freeze the keyboard and mouse.
Any suggestions is appreciated. Thanks in advance.
So I finally solved it.
The reason my program could not interact with desktop is that it runs in Session 0.
This is because the Windows services run in session 0 and cannot directly interact with desktop. Here by interaction I mean receiving keyboard, mouse events and creating or accessing windows in user's desktop.
So I created a service that runs with SYSTEM account. It will create the "freezer process" in user's session. Also this process will run with SYSTEM account, so the normal user will not have privileges to kill.
I have a requirement of simulating Ctrl+Alt+Del in remote system.I loaded sas.dll and called sendsas function but it is not working.How to display winlogon screen on remote system.
Thanks
As discussed here, you can try using Ctrl+Alt+End instead. This will bring up the Task Manager.
If this doesn't work for what you need, you can open the on-screen keyboard in the remote desktop, and click the Ctrl+Alt+Delete keys with the mouse.
I am developing a custom shell for a windows 8 tablet. I would like to intercept the tablets windows button press event. I am not sure how to do so. I am currently working in c#, but would be willing to consider any possible solutions. I have tried autohotkey, but the tablet button must not be the same as the keyboard windows key. Any suggestions?
I vaguely remember reading that Windows 8 requires running with admin rights. Could you try that?
I have a program that takes a long time to run and is intended to run unattended. In Windows, what is the best way to determine the users preferred poweroff action.
What the power button does.
In Windows 7, the start menu logoff action (Which is Shut Down by default).
How can I determine these values on Windows XP, Windows Vista and Windows 7?
Is there an API to do this? (i.e. Shutdown, Suspend, or Hibernate according to users preferences)
If you are using managed code, there is PowerGetActiveScheme. There is an example of how to use it here: http://www.pinvoke.net/default.aspx/powrprof.powergetactivescheme
I need to create a windows login UI for Windows 7 & Vista which logs user name and image from webcam (replacing their login screen). I don't know where to start from. Can I do this in C# or will I have to use C++? Any link will be helpful.
If you just need Windows 7 and Windows Vista support, you are looking for Credential Provider. You can find some samples in Windows SDK.
If you want to extend pre-Vista Windows, you are looking for GINA