![]() ![]() #How to install screensavers in windows 7 code#NET Framework, copy and paste the above code into lock.cs, then run: %SystemRoot%\Microsoft.NET\Framework\v3.5\csc.exe lock.cs SendMessage(GetDesktopWindow(), WM_SYSCOMMAND, SC_SCREENSAVE, 0) Public static void SetScreenSaverRunning() Private const int WM_SYSCOMMAND = 0x0112 Private const int SC_SCREENSAVE = 0xF140 Private static extern IntPtr LockWorkStation() Private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam) Private static extern IntPtr GetDesktopWindow() Putting together the cmd and vbs script ideas with the code from the answer to Launch System Screensaver from C# Windows Form I came up with the following: using System ![]() #How to install screensavers in windows 7 password#Even the answer to Launch System Screensaver from C# Windows Form only starts the screen saver, it does not password protect on resume. It may not be possible to reproduce the system behaviour of starting the screen saver and password protecting on resume. Neither of these answers is perfect, both reveal a flicker of the desktop after the screen saver is disabled and just prior to the workstation being locked. ObjShell.Run "rundll32.exe user32.dll,LockWorkStation" ReturnVal = objShell.Run("logon.scr", 1, True) ' The "True" argument will make the script wait for the screensaver to exit 6 When prompted, click/tap on Run, Yes ( UAC ), Yes, and OK to approve the merge. Or lock.vbs: Set objShell = CreateObject("Wscript.Shell") A) Click/tap on the Download button below to download the file below, and go to step 4 below. I did some additional searching and found that you could create lock.cmd: /wait logon.scr /s
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |