PointMan,
i'd like to know that what execution file is for windows key + R and
windows Key + L
When you press Win+R, the Windows Shell Run dialog box is shown. And, when
you press Win+L, the workstation is locked.
It might be possible to execute these two commands using RunDll32 (see for
example
http://www.mediachance.com/faqdll.htm how to lock the workstation),
but since this method is largely undocumented, you are better of calling the
correct APIs directly.
First, to display the Windows Run dialog box, do this:
1. Start a WinForms project in Visual Studio, and add a reference to
SHELL32.DLL to your project (this DLL is in the \Windows\System32
directory).
2. Add "using Shell32;" to your C# file.
3. Type in the following code:
Shell32.ShellClass shell = new ShellClass();
Shell32.IShellDispatch disp = (IShellDispatch)shell;
disp.FileRun();
Secondly, to lock the workstation, do this:
using System.Runtime.InteropServices;
...
[DllImport("user32.dll")]
public static extern void LockWorkStation();
private void button5_Click(object sender, EventArgs e)
{
LockWorkStation();
}
That's it. Have a nice weekend!
--
Regards,
Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethis.dystopia.fi http://www.saunalahti.fi/janij/