问题
I know that in windows 8, certain applications have a notification on the lock screen, and some fingerprint readers can add messages to the logon screen in windows 7 and older machines. Is it possible for a program to display a message on the logon screen for Windows 7 using c#? If so, can that message be dynamic?
回答1:
Yes it is possible to add/changes the logon screen message. It involves updating the legalnotiecaption
and legalnoticetext
values in the registry.
See this article for a detailed walkthrough: Display a Startup Message Box in Windows 8 It will work for Windows 7 also, since we are modifying the registry keys (which haven't changed between windows versions).
As for whether the message can be dynamic, I am not sure, since it comes from the registry. I guess you could write a C# app that stores the current / existing values for those 2 registry entries, then updates them at startup. (Don't forget to call Close()
on the RegistryKey
object in your C# code :)
Also, if you are "afraid" of modifying the registry entries directly, you can make the same changes by updating 2 options in the Local Security Policy. Behind the scenes, the 2 updates eventually update the same 2 registry keys - legalnotiecaption
and legalnoticetext
.
See: Create a logon message for users in Windows 7 | 8
- Run secpol.msc and hit Enter to open the Local Security Policy
- Expand Local Policies > Select Security options.
- In the RHS pane, double click
Interactive logon: Message title for users attempting to log on
. Change and save it. - In the RHS pane, double click
Interactive logon: Message text for users attempting to log on
. Change and save it.
来源:https://stackoverflow.com/questions/21806822/add-message-to-logon-screen-windows-7